From 80c520d76c0d884ae2c59ff70b34fc48f19778f3 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 3 Oct 2020 15:15:35 +0200 Subject: [PATCH] If no day of month, set the first day of the month --- media/forms.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/media/forms.py b/media/forms.py index 00cc1b9..00fad64 100644 --- a/media/forms.py +++ b/media/forms.py @@ -147,6 +147,8 @@ class MediaAdminForm(ModelForm): if 'publishedDate' in info: if "-" not in info["publishedDate"]: info["publishedDate"] += "-01-01" + elif len(info["publishedDate"]) == 7: + info["publishedDate"] += "-01" self.cleaned_data['publish_date'] = info['publishedDate'][:10] if 'authors' not in self.cleaned_data \