--- /dev/null
+# Generated by Django 4.1.9 on 2023-09-26 13:50
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("isbn", "0004_alter_isbn_form"),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name="isbn",
+ name="form",
+ field=models.CharField(
+ blank=True,
+ choices=[
+ ("html", "html"),
+ ("txt", "txt"),
+ ("pdf", "pdf"),
+ ("epub", "epub"),
+ ("mobi", "mobi"),
+ ("mp3", "mp3"),
+ ("paperback", "paperback"),
+ ],
+ default="",
+ max_length=32,
+ ),
+ preserve_default=False,
+ ),
+ ]
max_length=32, choices=[
(form, form)
for form, config in FORMS
- ], null=True, blank=True
+ ], blank=True
)
bn_data = models.TextField(blank=True)
wl_data = models.TextField(blank=True)
isbn, created = pool.isbn_set.get_or_create(
suffix=suffix,
)
+ add_note = False
if isbn.book is None:
isbn.book = catalogue_book
- else:
- assert isbn.book is catalogue_book
- if isbn.form is None:
+ elif isbn.book is not catalogue_book:
+ add_note = True
+ if not isbn.form:
isbn.form = form
- else:
- assert isbn.form == form
- isbn.save(update_fields=['book', 'form'])
+ elif isbn.form != form:
+ add_note = True
+ if add_note:
+ isbn.notes += '\n\n' + catalogue_book.slug + ' ' + form
+ isbn.save(update_fields=['book', 'form', 'notes'])