From a6d1abf2af0c0dd5d7865dda265c056051a2764f Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Thu, 24 May 2018 00:07:26 +0200 Subject: [PATCH] Remove collection from books --- manuels/admin.py | 6 +++--- .../migrations/0010_remove_book_collection.py | 17 +++++++++++++++++ manuels/models.py | 1 - 3 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 manuels/migrations/0010_remove_book_collection.py diff --git a/manuels/admin.py b/manuels/admin.py index 1bb6bde..0ce7d41 100644 --- a/manuels/admin.py +++ b/manuels/admin.py @@ -33,19 +33,19 @@ class LevelAdmin(admin.ModelAdmin): class BookResource(resources.ModelResource): class Meta: model = Book - fields = ('title', 'authors', 'editor', 'collection', 'publication_year', 'isbn', + fields = ('title', 'authors', 'editor', 'publication_year', 'isbn', 'price', 'previously_acquired', 'teacher__first_name', 'teacher__last_name', 'level__name', 'field') @admin.register(Book) class BookAdmin(ExportMixin, admin.ModelAdmin): resource_class = BookResource - list_display = ['title', 'authors', 'editor', 'collection', 'publication_year', 'isbn', + list_display = ['title', 'authors', 'editor', 'publication_year', 'isbn', 'price', 'previously_acquired', 'teacher', 'level', 'field'] list_filter = ['editor', 'previously_acquired', 'teacher', 'level'] fieldsets = [ ('Infos livre', { - 'fields': ('title', 'authors', 'editor', 'collection', 'publication_year', 'isbn', 'created_at', 'updated_at') + 'fields': ('title', 'authors', 'editor', 'publication_year', 'isbn', 'created_at', 'updated_at') }), ('Élève', { 'fields': ('price', 'previously_acquired',) diff --git a/manuels/migrations/0010_remove_book_collection.py b/manuels/migrations/0010_remove_book_collection.py new file mode 100644 index 0000000..3f6f3dc --- /dev/null +++ b/manuels/migrations/0010_remove_book_collection.py @@ -0,0 +1,17 @@ +# Generated by Django 2.0.5 on 2018-05-23 22:07 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('manuels', '0009_suppliesrequirement_field'), + ] + + operations = [ + migrations.RemoveField( + model_name='book', + name='collection', + ), + ] diff --git a/manuels/models.py b/manuels/models.py index 0585428..2d819a8 100644 --- a/manuels/models.py +++ b/manuels/models.py @@ -99,7 +99,6 @@ class Book(BaseModel): title = models.TextField('titre') authors = models.TextField('auteurs') editor = models.ForeignKey(verbose_name='éditeur', to=Editor, on_delete=models.PROTECT, null=True) - collection = models.CharField('collection', max_length=200, blank=True) publication_year = models.PositiveIntegerField('année de publication') isbn = models.CharField('ISBN/EAN', max_length=20, validators=[isbn_validator]) price = models.PositiveIntegerField('prix')