From 96dda660218abb92bd4cb8cf52d516e17badf9a8 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Tue, 17 Nov 2020 16:11:10 +0100 Subject: [PATCH] marked required fields with red stars --- input/forms.py | 28 +++++++++++++++++----------- input/templates/input/extern.html | 6 ++++++ 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/input/forms.py b/input/forms.py index 0d88ca3..37414c1 100644 --- a/input/forms.py +++ b/input/forms.py @@ -9,7 +9,13 @@ from .models import Project, Volunteer, Extern, IFG, Library, TYPE_CHOICES,\ from .settings import DATAPROTECTION, FOERDERRICHTLINIEN, NUTZUNGSBEDINGUNGEN -class ProjectForm(ModelForm): + +class FdbForm(ModelForm): + '''this base class provides the required css class for all forms''' + required_css_class = 'required' + + +class ProjectForm(FdbForm): # start = DateField(widget=AdminDateWidget()) @@ -20,7 +26,7 @@ class ProjectForm(ModelForm): widgets = {'start': AdminDateWidget(), 'end': AdminDateWidget(),} -class ExternForm(ModelForm): +class ExternForm(FdbForm): choice = ChoiceField(choices=TYPE_CHOICES.items(), widget=RadioSelect, label='Was möchtest Du beantragen?') @@ -37,7 +43,7 @@ INTERN_CHOICES = {'PRO': 'Projektsteckbrief', 'HON': 'Ehrenamtsbescheinigung, Akkreditierung oder Redaktionsbestätigung', 'TRAV': 'Reisekostenerstattung'} -class InternForm(ModelForm): +class InternForm(FdbForm): choice = ChoiceField(choices = INTERN_CHOICES.items(), widget=RadioSelect, label = 'Was möchtest Du eingeben?') @@ -45,7 +51,7 @@ class InternForm(ModelForm): model = Volunteer exclude = ('granted', 'granted_date', 'survey_mail_send') -class TravelForm(ModelForm): +class TravelForm(FdbForm): # TODO: add some javascript to show/hide other-field class Meta: model = Travel @@ -53,28 +59,28 @@ class TravelForm(ModelForm): widgets = {'checkin': AdminDateWidget(), 'checkout': AdminDateWidget(),} -class LibraryForm(ModelForm): +class LibraryForm(FdbForm): class Meta: model = Library fields = ['cost', 'library', 'duration', 'notes'] -class IFGForm(ModelForm): +class IFGForm(FdbForm): class Meta: model = IFG fields = ['cost', 'url', 'notes'] -class HonoraryCertificateForm(ModelForm): +class HonoraryCertificateForm(FdbForm): class Meta: model = HonoraryCertificate fields = ['request_url', 'project'] -class LiteratureForm(ModelForm): +class LiteratureForm(FdbForm): class Meta: model = Literature fields = ['cost', 'info', 'source', 'notes'] -class EmailForm(ModelForm): +class EmailForm(FdbForm): # TODO: add some javascript to show/hide other-field check = BooleanField(required=True, label=format_html("Ich stimme den Nutzungsbedingungen zu", @@ -84,12 +90,12 @@ class EmailForm(ModelForm): model = Email fields = ['domain', 'address', 'other'] -class BusinessCardForm(ModelForm): +class BusinessCardForm(FdbForm): class Meta: model = BusinessCard fields = ['project', 'data', 'variant', 'sent_to'] -class ListForm(ModelForm): +class ListForm(FdbForm): class Meta: model = List fields = ['domain', 'address'] diff --git a/input/templates/input/extern.html b/input/templates/input/extern.html index dea31f5..f8d051c 100644 --- a/input/templates/input/extern.html +++ b/input/templates/input/extern.html @@ -21,6 +21,10 @@ ul { padding-left: 10; } + label.required::after { + content: ' *'; + color: red; + } @@ -38,6 +42,8 @@ {{ wizard.form }} {% endif %} +

+ * Pflichtfeld

{% if wizard.steps.prev %}