diff --git a/media/migrations/0043_auto_20211023_2012.py b/media/migrations/0043_auto_20211023_2012.py index a1bc2f1..618dba3 100644 --- a/media/migrations/0043_auto_20211023_2012.py +++ b/media/migrations/0043_auto_20211023_2012.py @@ -21,6 +21,7 @@ class Migration(migrations.Migration): name='Borrowable', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('isbn', media.fields.ISBNField(blank=True, help_text='You may be able to scan it from a bar code.', max_length=28, null=True, unique=True, validators=[media.validators.isbn_validator], verbose_name='ISBN')), ('title', models.CharField(max_length=255, verbose_name='title')), ('present', models.BooleanField(default=False, help_text='Tell that the medium is present in the Mediatek.', verbose_name='present')), ('polymorphic_ctype', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_media.borrowable_set+', to='contenttypes.ContentType')), @@ -74,7 +75,6 @@ class Migration(migrations.Migration): name='Book', fields=[ ('medium_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='media.Medium')), - ('isbn', media.fields.ISBNField(blank=True, help_text='You may be able to scan it from a bar code.', max_length=28, null=True, unique=True, validators=[media.validators.isbn_validator], verbose_name='ISBN')), ('subtitle', models.CharField(blank=True, max_length=255, verbose_name='subtitle')), ('number_of_pages', models.PositiveIntegerField(blank=True, null=True, verbose_name='number of pages')), ('publish_date', models.DateField(blank=True, null=True, verbose_name='publish date')), diff --git a/media/models.py b/media/models.py index e16c65d..0932058 100644 --- a/media/models.py +++ b/media/models.py @@ -32,6 +32,14 @@ class Author(models.Model): class Borrowable(PolymorphicModel): + isbn = ISBNField( + _('ISBN'), + help_text=_('You may be able to scan it from a bar code.'), + unique=True, + blank=True, + null=True, + ) + title = models.CharField( max_length=255, verbose_name=_("title"), @@ -83,14 +91,6 @@ class Medium(Borrowable): class Book(Medium): - isbn = ISBNField( - _('ISBN'), - help_text=_('You may be able to scan it from a bar code.'), - unique=True, - blank=True, - null=True, - ) - subtitle = models.CharField( verbose_name=_('subtitle'), max_length=255,