1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2025-06-29 22:31:10 +02:00

Side identifiers cannot begin with le/la/les/l'/the

This commit is contained in:
Yohann D'ANELLO
2020-02-10 17:51:09 +01:00
parent 53ea1288c1
commit 3d81977dbd
3 changed files with 24 additions and 15 deletions

View File

@ -3,6 +3,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
import json
import re
import urllib.request
import unicodedata
@ -109,9 +110,15 @@ class MediaAdminForm(ModelForm):
author_name = self.cleaned_data['authors'][0].name
if ',' not in author_name and ' ' in author_name:
author_name = author_name.split(' ')[-1]
title_normalized = self.cleaned_data['title'].upper()
title_normalized = re.sub(r'^LE ', '', title_normalized)
title_normalized = re.sub(r'^LA ', '', title_normalized)
title_normalized = re.sub(r'^LES ', '', title_normalized)
title_normalized = re.sub(r'^L\'', '', title_normalized)
title_normalized = re.sub(r'^THE ', '', title_normalized)
side_identifier = "{:.3} {:.3}".format(
author_name,
self.cleaned_data['title'], )
title_normalized.replace(' ', ''), )
if self.cleaned_data['subtitle']:
start = self.cleaned_data['subtitle'].split(' ')[0] \