mirror of
https://gitlab.crans.org/mediatek/med.git
synced 2024-12-26 05:42:23 +00:00
FUCK LINTERS TEST
This commit is contained in:
parent
343ab02874
commit
2753f700a6
@ -4,8 +4,8 @@
|
||||
|
||||
import json
|
||||
import re
|
||||
import urllib.request
|
||||
import unicodedata
|
||||
import urllib.request
|
||||
|
||||
from django.forms import ModelForm
|
||||
|
||||
@ -103,16 +103,18 @@ class MediaAdminForm(ModelForm):
|
||||
self.download_data_openlibrary(isbn)
|
||||
|
||||
if self.cleaned_data['title']:
|
||||
self.cleaned_data['title'] = re.sub('\(AUT\) ',
|
||||
'', self.cleaned_data['title'])
|
||||
self.cleaned_data['title'] = re.sub(r'\(AUT\) ',
|
||||
'', self.cleaned_data['title'])
|
||||
|
||||
if self.cleaned_data['authors']:
|
||||
authors = self.cleaned_data['authors']
|
||||
old_authors = authors.copy()
|
||||
|
||||
def sort(author):
|
||||
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:
|
||||
@ -130,9 +132,9 @@ class MediaAdminForm(ModelForm):
|
||||
|
||||
if self.cleaned_data['subtitle']:
|
||||
self.cleaned_data['subtitle'] = re.sub(r'</span>',
|
||||
'', self.cleaned_data['subtitle'])
|
||||
'', self.cleaned_data['subtitle'])
|
||||
self.cleaned_data['subtitle'] = re.sub(r'<span.*>',
|
||||
'', self.cleaned_data['subtitle'])
|
||||
'', self.cleaned_data['subtitle'])
|
||||
start = self.cleaned_data['subtitle'].split(' ')[0] \
|
||||
.replace('.', '')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user