1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2024-12-28 04:22:24 +00:00

Keep displaying models in Django-Admin main menu

This commit is contained in:
Yohann D'ANELLO 2021-10-26 11:42:32 +02:00
parent e3bab2389c
commit 54f8198b86
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

@ -23,6 +23,7 @@ class AuthorAdmin(VersionAdmin):
class BorrowableAdmin(PolymorphicParentModelAdmin):
search_fields = ('title',)
child_models = (CD, Comic, Manga, Novel, Review, Vinyl,)
show_in_index = False
class MediumAdmin(VersionAdmin, PolymorphicChildModelAdmin):
@ -33,6 +34,7 @@ class MediumAdmin(VersionAdmin, PolymorphicChildModelAdmin):
autocomplete_fields = ('authors',)
date_hierarchy = 'publish_date'
form = MediaAdminForm
show_in_index = True
def authors_list(self, obj):
return ", ".join([a.name for a in obj.authors.all()])
@ -88,6 +90,7 @@ class CDAdmin(VersionAdmin, PolymorphicChildModelAdmin):
list_display = ('title', 'authors_list', 'side_identifier',)
search_fields = ('title', 'authors__name', 'side_identifier',)
autocomplete_fields = ('authors',)
show_in_index = True
def authors_list(self, obj):
return ", ".join([a.name for a in obj.authors.all()])
@ -99,6 +102,7 @@ class VinylAdmin(VersionAdmin, PolymorphicChildModelAdmin):
list_display = ('title', 'authors_list', 'side_identifier', 'rpm',)
search_fields = ('title', 'authors__name', 'side_identifier', 'rpm',)
autocomplete_fields = ('authors',)
show_in_index = True
def authors_list(self, obj):
return ", ".join([a.name for a in obj.authors.all()])
@ -109,6 +113,7 @@ class VinylAdmin(VersionAdmin, PolymorphicChildModelAdmin):
class ReviewAdmin(VersionAdmin, PolymorphicChildModelAdmin):
list_display = ('__str__', 'number', 'year', 'month', 'day', 'double',)
search_fields = ('title', 'number', 'year',)
show_in_index = True
class EmpruntAdmin(VersionAdmin):