From 8dd94e2fc4a0e7314dc4f60720f204bc047d2b77 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Thu, 20 Feb 2025 23:27:22 -0500 Subject: [PATCH] [books] Fix book admin --- vrobbler/apps/books/admin.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/vrobbler/apps/books/admin.py b/vrobbler/apps/books/admin.py index f2cc3bd..e61c12a 100644 --- a/vrobbler/apps/books/admin.py +++ b/vrobbler/apps/books/admin.py @@ -1,7 +1,5 @@ +from books.models import Author, Book, Paper from django.contrib import admin - -from books.models import Author, Book, Page - from scrobbles.admin import ScrobbleInline @@ -18,13 +16,6 @@ class AuthorAdmin(admin.ModelAdmin): search_fields = ("name",) -@admin.register(Page) -class PageAdmin(admin.ModelAdmin): - date_hierarchy = "created" - list_filter = ("book",) - ordering = ("book", "number") - - @admin.register(Book) class BookAdmin(admin.ModelAdmin): date_hierarchy = "created" @@ -40,3 +31,20 @@ class BookAdmin(admin.ModelAdmin): inlines = [ ScrobbleInline, ] + + +@admin.register(Paper) +class BookAdmin(admin.ModelAdmin): + date_hierarchy = "created" + list_display = ( + "title", + "subtitle", + "arxiv_id", + "first_publish_year", + "pages", + ) + search_fields = ("name",) + ordering = ("-created",) + inlines = [ + ScrobbleInline, + ]