Add notes to collections in catalogue.
authorRadek Czajka <rczajka@rczajka.pl>
Tue, 6 Jul 2021 12:09:32 +0000 (14:09 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Tue, 6 Jul 2021 12:09:32 +0000 (14:09 +0200)
src/catalogue/admin.py
src/catalogue/migrations/0030_auto_20210706_1408.py [new file with mode: 0644]
src/catalogue/models.py

index a628961..8ce330c 100644 (file)
@@ -137,7 +137,7 @@ class CollectionAdmin(admin.ModelAdmin):
     autocomplete_fields = []
     prepopulated_fields = {"slug": ("name",)}
     search_fields = ["name"]
-    fields = ['name', 'slug', 'category', 'estimated_costs']
+    fields = ['name', 'slug', 'category', 'notes', 'estimated_costs']
     readonly_fields = ['estimated_costs']
     inlines = [AuthorInline, BookInline]
 
diff --git a/src/catalogue/migrations/0030_auto_20210706_1408.py b/src/catalogue/migrations/0030_auto_20210706_1408.py
new file mode 100644 (file)
index 0000000..17b14b8
--- /dev/null
@@ -0,0 +1,23 @@
+# Generated by Django 3.1.13 on 2021-07-06 14:08
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('catalogue', '0029_auto_20201102_1315'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='collection',
+            name='notes',
+            field=models.TextField(blank=True, verbose_name='notes'),
+        ),
+        migrations.AddField(
+            model_name='collectioncategory',
+            name='notes',
+            field=models.TextField(blank=True, verbose_name='notes'),
+        ),
+    ]
index 1897846..2ceb110 100644 (file)
@@ -177,6 +177,7 @@ class Book(WikidataMixin, models.Model):
 class CollectionCategory(models.Model):
     name = models.CharField(_("name"), max_length=255)
     parent = models.ForeignKey('self', models.SET_NULL, related_name='children', null=True, blank=True, verbose_name=_("parent"))
+    notes = models.TextField(_("notes"), blank=True)
 
     class Meta:
         ordering = ('parent__name', 'name')
@@ -194,6 +195,7 @@ class Collection(models.Model):
     name = models.CharField(_("name"), max_length=255)
     slug = models.SlugField(max_length=255, unique=True)
     category = models.ForeignKey(CollectionCategory, models.SET_NULL, null=True, blank=True, verbose_name=_("category"))
+    notes = models.TextField(_("notes"), blank=True)
 
     class Meta:
         ordering = ('category', 'name')