Commit 9dd2a142 authored by ynerant's avatar ynerant

Better publish date

parent dcba8325
Pipeline #4243 failed with stages
in 3 minutes and 32 seconds
......@@ -108,7 +108,9 @@ class MediaAdminForm(ModelForm):
data.setdefault("authors", [])
data.setdefault("image", "")
self.cleaned_data["title"] = data["title"]
self.cleaned_data["published_date"] = data["date_published"][:10]
self.cleaned_data["publish_date"] = data["date_published"][:10]
while len(self.cleaned_data["publish_date"]) == 4 or len(self.cleaned_data["publish_date"]) == 7:
self.cleaned_data["publish_date"] += "-01"
self.cleaned_data["number_of_pages"] = data["pages"]
self.cleaned_data["authors"] = \
list(Auteur.objects.get_or_create(name=author_name)[0] for author_name in data["authors"])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment