-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.py
35 lines (25 loc) · 865 Bytes
/
admin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from django.contrib import admin
from plugins.books.models import *
class BookSettingAdmin(admin.ModelAdmin):
list_display = ('book_page_title',)
class ChapterAdmin(admin.ModelAdmin):
"""Displays objects in the Django admin interface."""
list_display = ('title', 'number', 'book', 'pages', 'doi')
list_filter = ('book',)
search_fields = ('title',)
raw_id_fields = ('book',)
filter_horizontal = ('contributors',)
class BookAccessAdmin(admin.ModelAdmin):
list_display = ('book', 'chapter', 'type', 'format', 'country', 'accessed')
list_filter = ('book',)
search_fields = ('book__title',)
admin_list = [
(Book, ),
(Contributor,),
(Format,),
(BookAccess, BookAccessAdmin),
(Chapter, ChapterAdmin),
(Category,),
(BookSetting, BookSettingAdmin)
]
[admin.site.register(*t) for t in admin_list]