Give ISBN to each borrowable object, even if it does not have one
This commit is contained in:
parent
a01d480dd2
commit
c424c7c040
|
@ -21,6 +21,7 @@ class Migration(migrations.Migration):
|
||||||
name='Borrowable',
|
name='Borrowable',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
('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')),
|
('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')),
|
('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')),
|
('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',
|
name='Book',
|
||||||
fields=[
|
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')),
|
('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')),
|
('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')),
|
('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')),
|
('publish_date', models.DateField(blank=True, null=True, verbose_name='publish date')),
|
||||||
|
|
|
@ -32,6 +32,14 @@ class Author(models.Model):
|
||||||
|
|
||||||
|
|
||||||
class Borrowable(PolymorphicModel):
|
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(
|
title = models.CharField(
|
||||||
max_length=255,
|
max_length=255,
|
||||||
verbose_name=_("title"),
|
verbose_name=_("title"),
|
||||||
|
@ -83,14 +91,6 @@ class Medium(Borrowable):
|
||||||
|
|
||||||
|
|
||||||
class Book(Medium):
|
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(
|
subtitle = models.CharField(
|
||||||
verbose_name=_('subtitle'),
|
verbose_name=_('subtitle'),
|
||||||
max_length=255,
|
max_length=255,
|
||||||
|
|
Loading…
Reference in New Issue