From ef710bf96489dc18f008cb41eba01036b4559d79 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Mon, 10 Feb 2020 17:35:35 +0100 Subject: [PATCH] Fix author sort --- media/forms.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/media/forms.py b/media/forms.py index 18f91a0..b38e091 100644 --- a/media/forms.py +++ b/media/forms.py @@ -102,7 +102,9 @@ class MediaAdminForm(ModelForm): authors = self.cleaned_data['authors'] old_authors = authors.copy() def sort(author): - return str(-author.note) + "." + str(old_authors.index(author)) + "." + author.name + return str(-author.note) + "." \ + + str(old_authors.index(author)) \ + + "." + author.name authors.sort(key=sort) author_name = self.cleaned_data['authors'][0].name if ',' not in author_name and ' ' in author_name: