FUCK LINTERS TEST
This commit is contained in:
parent
343ab02874
commit
2753f700a6
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import urllib.request
|
|
||||||
import unicodedata
|
import unicodedata
|
||||||
|
import urllib.request
|
||||||
|
|
||||||
from django.forms import ModelForm
|
from django.forms import ModelForm
|
||||||
|
|
||||||
|
@ -103,16 +103,18 @@ class MediaAdminForm(ModelForm):
|
||||||
self.download_data_openlibrary(isbn)
|
self.download_data_openlibrary(isbn)
|
||||||
|
|
||||||
if self.cleaned_data['title']:
|
if self.cleaned_data['title']:
|
||||||
self.cleaned_data['title'] = re.sub('\(AUT\) ',
|
self.cleaned_data['title'] = re.sub(r'\(AUT\) ',
|
||||||
'', self.cleaned_data['title'])
|
'', self.cleaned_data['title'])
|
||||||
|
|
||||||
if self.cleaned_data['authors']:
|
if self.cleaned_data['authors']:
|
||||||
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) + "." \
|
return str(-author.note) + "." \
|
||||||
+ str(old_authors.index(author)) \
|
+ str(old_authors.index(author)) \
|
||||||
+ "." + author.name
|
+ "." + 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