manuels-scolaires/manuels/admin.py

38 lines
1 KiB
Python
Raw Normal View History

2018-05-21 19:28:36 +02:00
from django.contrib import admin
2018-05-22 01:35:05 +02:00
from manuels.models import Teacher, Book, Level, Editor
2018-05-21 23:12:35 +02:00
@admin.register(Teacher)
class TeacherAdmin(admin.ModelAdmin):
2018-05-22 01:43:39 +02:00
list_display = ['full_name', 'email', 'phone_number']
2018-05-21 23:12:35 +02:00
@admin.register(Level)
class LevelAdmin(admin.ModelAdmin):
pass
@admin.register(Book)
class BookAdmin(admin.ModelAdmin):
2018-05-22 01:43:39 +02:00
list_display = ['title', 'authors', 'editor', 'collection', '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')
}),
('Élève', {
'fields': ('price', 'previously_acquired',)
}),
('Enseignant', {
'fields': ('teacher', 'level', 'field')
}),
]
readonly_fields = ['created_at', 'updated_at']
2018-05-22 01:35:05 +02:00
@admin.register(Editor)
class EditorAdmin(admin.ModelAdmin):
pass