Remove collection from books

This commit is contained in:
Gabriel Augendre 2018-05-24 00:07:26 +02:00
parent b7d7e7098d
commit a6d1abf2af
3 changed files with 20 additions and 4 deletions

View file

@ -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',)

View file

@ -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',
),
]

View file

@ -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')