From c27e4c5183e65538939b2902e486de5e1ab55b09 Mon Sep 17 00:00:00 2001 From: Oliver Zander Date: Wed, 15 Oct 2025 12:20:11 +0200 Subject: [PATCH] cleaned up project forms --- input/forms.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/input/forms.py b/input/forms.py index 4679d37..a832a76 100755 --- a/input/forms.py +++ b/input/forms.py @@ -307,13 +307,12 @@ class ListForm(BaseApplicationForm, CommonOrderMixin): self.fields['address'].initial = '' -class ProjectRequestForm(CommonOrderMixin, forms.ModelForm): +class ProjectRequestForm(BaseApplicationForm, CommonOrderMixin): """ Public-facing form for < 1000 EUR project requests. Key points: - JSONField-backed multi-selects are exposed as MultipleChoiceField with checkbox widgets. - - We return `list(...)` in clean_* so the JSONField gets a native list. - Extra UX tweaks: textareas for long text, number inputs with min/max/step, help_texts with links via format_html. """ @@ -374,13 +373,6 @@ class ProjectRequestForm(CommonOrderMixin, forms.ModelForm): 'Falls du noch weitere Informationen hast, teile sie gern an dieser Stelle mit uns. Für umfangreichere Informationen, schreibe uns eine E-Mail an community@wikimedia.de.'), } - # Persist multi-selects as Python lists so JSONField stores a JSON array - def clean_categories(self): - return list(self.cleaned_data.get('categories', [])) - - def clean_wikimedia_projects(self): - return list(self.cleaned_data.get('wikimedia_projects', [])) - class ProjectRequestAdminForm(forms.ModelForm): """ @@ -395,7 +387,7 @@ class ProjectRequestAdminForm(forms.ModelForm): categories = forms.MultipleChoiceField( choices=[(c, c) for c in PROJECT_CATEGORIES], widget=forms.CheckboxSelectMultiple, - label='Projektkategorie' + label='Projektkategorie(n)' ) wikimedia_projects = forms.MultipleChoiceField( choices=[(w, w) for w in WIKIMEDIA_CHOICES], @@ -404,9 +396,6 @@ class ProjectRequestAdminForm(forms.ModelForm): ) class Meta: - model = ProjectRequest - fields = "__all__" - # Make longer texts easier to edit in the admin UI widgets = { 'description': forms.Textarea(attrs={'rows': 5}),