From 5ba81ec6f625fe4c9e59f10fccc6a73272600fa8 Mon Sep 17 00:00:00 2001
From: loulous27
Date: Fri, 28 Nov 2025 21:18:49 +0100
Subject: [PATCH] Add multilines description
---
photologue/forms.py | 15 +++++++++++----
.../templates/photologue/gallery_detail.html | 2 +-
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/photologue/forms.py b/photologue/forms.py
index b91adfe..1fef985 100644
--- a/photologue/forms.py
+++ b/photologue/forms.py
@@ -18,7 +18,13 @@ class MultipleFileInput(forms.ClearableFileInput):
class MultipleFileField(forms.FileField):
- allowed_extensions = ['jpg', 'jpeg', 'png', 'gif', 'tiff'] # Specify allowed extensions here
+ allowed_extensions = [
+ "jpg",
+ "jpeg",
+ "png",
+ "gif",
+ "tiff",
+ ] # Specify allowed extensions here
def __init__(self, *args, **kwargs):
kwargs.setdefault(
@@ -46,7 +52,7 @@ class MultipleFileField(forms.FileField):
cleaned_file = single_file_clean(file, initial)
# Check the file extension
- extension = file.name.split('.')[-1].lower()
+ extension = file.name.split(".")[-1].lower()
if extension not in self.allowed_extensions:
raise forms.ValidationError(
f"{file.name} has an invalid file extension. "
@@ -83,8 +89,9 @@ class UploadForm(forms.Form):
required=False,
)
new_gallery_description = forms.CharField(
+ widget=forms.Textarea(attrs={"rows": 4}),
label=_("Description"),
- required=False
+ required=False,
)
new_gallery_tags = forms.ModelMultipleChoiceField(
Tag.objects.all(),
@@ -146,7 +153,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"]
+ description=self.cleaned_data["new_gallery_description"],
)
for tag in self.cleaned_data["new_gallery_tags"]:
gallery.tags.add(tag)
diff --git a/photologue/templates/photologue/gallery_detail.html b/photologue/templates/photologue/gallery_detail.html
index a5dd09d..7ed5f2f 100644
--- a/photologue/templates/photologue/gallery_detail.html
+++ b/photologue/templates/photologue/gallery_detail.html
@@ -47,7 +47,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% endfor %}
{% endif %}
-{% if gallery.description %}{{ gallery.description|safe }}
{% endif %}
+{% if gallery.description %}{{ gallery.description|safe|linebreaksbr }}
{% endif %}