1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2024-11-26 23:27:09 +00:00

Get only the ten first characters for the date

This commit is contained in:
Yohann D'ANELLO 2020-10-02 17:42:56 +02:00
parent 8c8692b8d2
commit 9c53d89ad3

View File

@ -137,7 +137,7 @@ class MediaAdminForm(ModelForm):
if 'publishedDate' in info: if 'publishedDate' in info:
if "-" not in info["publishedDate"]: if "-" not in info["publishedDate"]:
info["publishedDate"] += "-01-01" info["publishedDate"] += "-01-01"
self.cleaned_data['publish_date'] = info['publishedDate'] self.cleaned_data['publish_date'] = info['publishedDate'][:10]
if 'authors' not in self.cleaned_data \ if 'authors' not in self.cleaned_data \
or not self.cleaned_data['authors']: or not self.cleaned_data['authors']: