mirror of
https://gitlab.crans.org/mediatek/med.git
synced 2024-12-25 06:22:23 +00:00
Better publish date
This commit is contained in:
parent
dcba832549
commit
9dd2a142b7
@ -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"])
|
||||
|
Loading…
Reference in New Issue
Block a user