From e03461777af2a9d33062dda1bf888e9025731f3e Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Wed, 25 Oct 2017 15:34:20 +0200 Subject: [PATCH] add field to mark books as recommended --- src/catalogue/admin.py | 2 +- .../migrations/0015_book_recommended.py | 19 +++++++++++++++++++ src/catalogue/models/book.py | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/catalogue/migrations/0015_book_recommended.py diff --git a/src/catalogue/admin.py b/src/catalogue/admin.py index 7cf0f5bf6..51305e276 100644 --- a/src/catalogue/admin.py +++ b/src/catalogue/admin.py @@ -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 index 000000000..6e04500cd --- /dev/null +++ b/src/catalogue/migrations/0015_book_recommended.py @@ -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'), + ), + ] diff --git a/src/catalogue/models/book.py b/src/catalogue/models/book.py index 8dc39fef2..b0c63a0ec 100644 --- a/src/catalogue/models/book.py +++ b/src/catalogue/models/book.py @@ -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( -- 2.20.1