Add description on new Galeries Upload

This commit is contained in:
loulous27 2025-11-28 20:46:18 +01:00
parent 6aeec81b5c
commit 4f877dd2f2
2 changed files with 7 additions and 0 deletions

View file

@ -82,6 +82,10 @@ class UploadForm(forms.Form):
initial=datetime.date.today,
required=False,
)
new_gallery_description = forms.CharField(
label=_("Description"),
required=False
)
new_gallery_tags = forms.ModelMultipleChoiceField(
Tag.objects.all(),
label=_("New gallery tags"),
@ -104,6 +108,7 @@ class UploadForm(forms.Form):
Div("new_gallery_date_end", css_class="col"),
css_class="row",
),
"new_gallery_description",
"new_gallery_tags",
Submit("submit", _("Upload"), css_class="btn btn-success mt-2"),
)
@ -141,6 +146,7 @@ class UploadForm(forms.Form):
slug=slugify(title),
date_start=self.cleaned_data["new_gallery_date_start"],
date_end=self.cleaned_data["new_gallery_date_end"],
description=self.cleaned_data["new_gallery_description"]
)
for tag in self.cleaned_data["new_gallery_tags"]:
gallery.tags.add(tag)