add field to mark books as recommended
authorJan Szejko <janek37@gmail.com>
Wed, 25 Oct 2017 13:34:20 +0000 (15:34 +0200)
committerJan Szejko <janek37@gmail.com>
Wed, 25 Oct 2017 13:51:44 +0000 (15:51 +0200)
(cherry picked from commit e034617)

src/catalogue/admin.py
src/catalogue/migrations/0015_book_recommended.py [new file with mode: 0644]
src/catalogue/models/book.py

index 7cf0f5b..51305e2 100644 (file)
@@ -37,7 +37,7 @@ class BookAdmin(TaggableModelAdmin):
     def change_view(self, request, object_id, extra_context=None):
         if 'advanced' not in request.GET:
             self.form = forms.ModelForm
-            self.fields = ('title', 'description', 'gazeta_link', 'wiki_link')
+            self.fields = ('title', 'description', 'gazeta_link', 'wiki_link', 'recommended')
             self.readonly_fields = ('title',)
         else:
             self.form = TaggableModelForm
diff --git a/src/catalogue/migrations/0015_book_recommended.py b/src/catalogue/migrations/0015_book_recommended.py
new file mode 100644 (file)
index 0000000..6e04500
--- /dev/null
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('catalogue', '0014_auto_20170627_1442'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='book',
+            name='recommended',
+            field=models.BooleanField(default=False, verbose_name='recommended'),
+        ),
+    ]
index 8dc39fe..b0c63a0 100644 (file)
@@ -61,6 +61,7 @@ class Book(models.Model):
     gazeta_link = models.CharField(blank=True, max_length=240)
     wiki_link = models.CharField(blank=True, max_length=240)
     print_on_demand = models.BooleanField(_('print on demand'), default=False)
+    recommended = models.BooleanField(_('recommended'), default=False)
 
     # files generated during publication
     cover = EbookField(