1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2024-11-30 06:53:03 +00:00

If no day of month, set the first day of the month

This commit is contained in:
Yohann D'ANELLO 2020-10-03 15:15:35 +02:00
parent 665f7a2875
commit 80c520d76c

View File

@ -147,6 +147,8 @@ 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"
elif len(info["publishedDate"]) == 7:
info["publishedDate"] += "-01"
self.cleaned_data['publish_date'] = info['publishedDate'][:10] self.cleaned_data['publish_date'] = info['publishedDate'][:10]
if 'authors' not in self.cleaned_data \ if 'authors' not in self.cleaned_data \