Add subtitle to admin
This commit is contained in:
parent
7d94609f9b
commit
07c21b9c79
|
@ -18,7 +18,7 @@ class AuteurAdmin(VersionAdmin):
|
||||||
|
|
||||||
|
|
||||||
class MediaAdmin(VersionAdmin):
|
class MediaAdmin(VersionAdmin):
|
||||||
list_display = ('title', 'authors_list', 'side_identifier', 'isbn',
|
list_display = ('full_name', 'authors_list', 'side_identifier', 'isbn',
|
||||||
'external_link')
|
'external_link')
|
||||||
search_fields = ('title', 'authors__nom', 'side_identifier', 'subtitle',
|
search_fields = ('title', 'authors__nom', 'side_identifier', 'subtitle',
|
||||||
'isbn')
|
'isbn')
|
||||||
|
@ -26,6 +26,14 @@ class MediaAdmin(VersionAdmin):
|
||||||
date_hierarchy = 'publish_date'
|
date_hierarchy = 'publish_date'
|
||||||
form = MediaAdminForm
|
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):
|
def authors_list(self, obj):
|
||||||
return ", ".join([a.nom for a in obj.authors.all()])
|
return ", ".join([a.nom for a in obj.authors.all()])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue