summaryrefslogtreecommitdiff
path: root/app/books/admin.py
diff options
context:
space:
mode:
authorlxf <sng@luxagraf.net>2020-12-20 12:00:43 -0500
committerlxf <sng@luxagraf.net>2020-12-20 12:00:43 -0500
commitea2a62f8e83808904ef58659fc4a52c9a5e98e0e (patch)
treeb318b7528b2c0a73e452260ce7b7a9a5ef26b77e /app/books/admin.py
parent099d4cf95be062e9f5259a323f54d6e7df4ec301 (diff)
added a way to hide highlights and edit inline with book
Diffstat (limited to 'app/books/admin.py')
-rw-r--r--app/books/admin.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/app/books/admin.py b/app/books/admin.py
index f488fe5..f0303a4 100644
--- a/app/books/admin.py
+++ b/app/books/admin.py
@@ -1,17 +1,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',)