Commit 626990b1 authored by erdnaxe's avatar erdnaxe 🎇

Use media str method for admin

parent 04c00fd5
Pipeline #1446 passed with stage
in 3 minutes and 25 seconds
......@@ -18,7 +18,7 @@ class AuteurAdmin(VersionAdmin):
class MediaAdmin(VersionAdmin):
list_display = ('full_name', 'authors_list', 'side_identifier', 'isbn',
list_display = ('__str__', 'authors_list', 'side_identifier', 'isbn',
'external_link')
search_fields = ('title', 'authors__nom', 'side_identifier', 'subtitle',
'isbn')
......@@ -26,14 +26,6 @@ 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()])
......
......@@ -63,8 +63,10 @@ class Media(models.Model):
)
def __str__(self):
return str(self.title) + ' - ' + str(self.subtitle) \
+ ' - ' + str(self.authors.all().first())
if self.subtitle:
return "{} : {}".format(self.title, self.subtitle)
else:
return self.title
class Meta:
verbose_name = _("medium")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment