mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 13:17:50 +02:00
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:
@@ -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
|
||||
|
Reference in New Issue
Block a user