mirror of
https://gitlab.crans.org/mediatek/med.git
synced 2025-07-06 04:03:53 +02:00
More testing
This commit is contained in:
@ -23,7 +23,7 @@ class ISBNField(CharField):
|
||||
kwargs['verbose_name'] = kwargs[
|
||||
'verbose_name'] if 'verbose_name' in kwargs else u'ISBN'
|
||||
kwargs['validators'] = [isbn_validator]
|
||||
super(ISBNField, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def formfield(self, **kwargs):
|
||||
defaults = {
|
||||
@ -31,10 +31,10 @@ class ISBNField(CharField):
|
||||
'validators': [isbn_validator],
|
||||
}
|
||||
defaults.update(kwargs)
|
||||
return super(ISBNField, self).formfield(**defaults)
|
||||
return super().formfield(**defaults)
|
||||
|
||||
def deconstruct(self):
|
||||
name, path, args, kwargs = super(ISBNField, self).deconstruct()
|
||||
name, path, args, kwargs = super().deconstruct()
|
||||
# Only include clean_isbn in kwarg if it's not the default value
|
||||
if not self.clean_isbn:
|
||||
kwargs['clean_isbn'] = self.clean_isbn
|
||||
@ -49,7 +49,7 @@ class ISBNField(CharField):
|
||||
if self.clean_isbn and value not in EMPTY_VALUES:
|
||||
cleaned_isbn = value.replace(' ', '').replace('-', '').upper()
|
||||
setattr(model_instance, self.attname, cleaned_isbn)
|
||||
return super(ISBNField, self).pre_save(model_instance, add)
|
||||
return super().pre_save(model_instance, add)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.value
|
||||
|
Reference in New Issue
Block a user