marked required fields with red stars

This commit is contained in:
Benni Baermann 2020-11-17 16:11:10 +01:00
parent f899567ab9
commit 96dda66021
2 changed files with 23 additions and 11 deletions

View file

@ -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 <a href='{}'>Nutzungsbedingungen</a> 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']

View file

@ -21,6 +21,10 @@
ul {
padding-left: 10;
}
label.required::after {
content: ' *';
color: red;
}
</style>
<img src="{% static 'input/logo.png' %}" />
@ -38,6 +42,8 @@
{{ wizard.form }}
{% endif %}
</table>
<p>
<span style="color: red">*</span> Pflichtfeld
<p>
{% if wizard.steps.prev %}
<button formnovalidate="formnovalidate" name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}">Zurück</button>