Add a custom manager to filter private and unpublished stuff (#39)

* Implement a customer manager for flatpages

* Implement public manager for private objects

* Add support for unpublished objects in roster and consist

* Add support for unpublished objects in bookshelf

* Update filtering on REST views

* Use uuid in urls.py

* Increment version
This commit is contained in:
2024-11-04 15:00:34 +01:00
committed by GitHub
parent 61b6d7a84e
commit 1c07c6a7a9
22 changed files with 297 additions and 154 deletions

View File

@@ -24,14 +24,48 @@ class BookAdmin(SortableAdminBase, admin.ModelAdmin):
inlines = (BookImageInline, BookPropertyInline,)
list_display = (
"title",
"published",
"get_authors",
"get_publisher",
"publication_year",
"number_of_pages"
)
readonly_fields = ("creation_time", "updated_time")
search_fields = ("title", "publisher__name", "authors__last_name")
list_filter = ("publisher__name", "authors")
fieldsets = (
(
None,
{
"fields": (
"published",
"title",
"authors",
"publisher",
"ISBN",
"language",
"number_of_pages",
"publication_year",
"description",
"purchase_date",
"notes",
"tags",
)
},
),
(
"Audit",
{
"classes": ("collapse",),
"fields": (
"creation_time",
"updated_time",
),
},
),
)
@admin.display(description="Publisher")
def get_publisher(self, obj):
return obj.publisher.name