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
36
37
38
39
40
41
42
43
44
45
|
from django.contrib import admin
from .models import Book, BookHighlight
class BookHighlightInline(admin.StackedInline):
model = BookHighlight
extra = 0
fieldsets = (
(None, {
'fields': (
'book',
'body_markdown',
'page',
'is_public',
)
}),
)
@admin.register(Book)
class BookAdmin(admin.ModelAdmin):
list_display = ('title', 'admin_thumbnail', 'rating', 'isbn', 'author_name', 'read_date', 'publish_date')
search_fields = ['title', 'body_markdown']
list_filter = ('rating', 'read_date')
inlines = [BookHighlightInline,]
class Media:
js = ('next-prev-links.js',)
@admin.register(BookHighlight)
class BookHighlightAdmin(admin.ModelAdmin):
list_display = ('book', 'page', 'date_highlighted')
fieldsets = (
(None, {
'fields': (
'book',
'body_markdown',
'is_public',
'page',
'date_highlighted',
)
}),
)
class Media:
js = ('next-prev-links.js',)
|