mirror of
https://gitlab.crans.org/mediatek/med.git
synced 2024-11-26 21:27:11 +00:00
Add subtitle to admin
This commit is contained in:
parent
7d94609f9b
commit
07c21b9c79
@ -18,7 +18,7 @@ class AuteurAdmin(VersionAdmin):
|
||||
|
||||
|
||||
class MediaAdmin(VersionAdmin):
|
||||
list_display = ('title', 'authors_list', 'side_identifier', 'isbn',
|
||||
list_display = ('full_name', 'authors_list', 'side_identifier', 'isbn',
|
||||
'external_link')
|
||||
search_fields = ('title', 'authors__nom', 'side_identifier', 'subtitle',
|
||||
'isbn')
|
||||
@ -26,6 +26,14 @@ class MediaAdmin(VersionAdmin):
|
||||
date_hierarchy = 'publish_date'
|
||||
form = MediaAdminForm
|
||||
|
||||
def full_name(self, obj):
|
||||
if obj.subtitle:
|
||||
return "{} : {}".format(obj.title, obj.subtitle)
|
||||
else:
|
||||
return obj.title
|
||||
|
||||
full_name.short_description = _('name')
|
||||
|
||||
def authors_list(self, obj):
|
||||
return ", ".join([a.nom for a in obj.authors.all()])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user