Fix author sort
This commit is contained in:
parent
71a8aa065b
commit
ef710bf964
|
@ -102,7 +102,9 @@ class MediaAdminForm(ModelForm):
|
||||||
authors = self.cleaned_data['authors']
|
authors = self.cleaned_data['authors']
|
||||||
old_authors = authors.copy()
|
old_authors = authors.copy()
|
||||||
def sort(author):
|
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)
|
authors.sort(key=sort)
|
||||||
author_name = self.cleaned_data['authors'][0].name
|
author_name = self.cleaned_data['authors'][0].name
|
||||||
if ',' not in author_name and ' ' in author_name:
|
if ',' not in author_name and ' ' in author_name:
|
||||||
|
|
Loading…
Reference in New Issue