marked required fields with red stars

This commit is contained in:
Benni Bärmann 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 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()) # start = DateField(widget=AdminDateWidget())
@ -20,7 +26,7 @@ class ProjectForm(ModelForm):
widgets = {'start': AdminDateWidget(), widgets = {'start': AdminDateWidget(),
'end': AdminDateWidget(),} 'end': AdminDateWidget(),}
class ExternForm(ModelForm): class ExternForm(FdbForm):
choice = ChoiceField(choices=TYPE_CHOICES.items(), widget=RadioSelect, choice = ChoiceField(choices=TYPE_CHOICES.items(), widget=RadioSelect,
label='Was möchtest Du beantragen?') label='Was möchtest Du beantragen?')
@ -37,7 +43,7 @@ INTERN_CHOICES = {'PRO': 'Projektsteckbrief',
'HON': 'Ehrenamtsbescheinigung, Akkreditierung oder Redaktionsbestätigung', 'HON': 'Ehrenamtsbescheinigung, Akkreditierung oder Redaktionsbestätigung',
'TRAV': 'Reisekostenerstattung'} 'TRAV': 'Reisekostenerstattung'}
class InternForm(ModelForm): class InternForm(FdbForm):
choice = ChoiceField(choices = INTERN_CHOICES.items(), widget=RadioSelect, choice = ChoiceField(choices = INTERN_CHOICES.items(), widget=RadioSelect,
label = 'Was möchtest Du eingeben?') label = 'Was möchtest Du eingeben?')
@ -45,7 +51,7 @@ class InternForm(ModelForm):
model = Volunteer model = Volunteer
exclude = ('granted', 'granted_date', 'survey_mail_send') exclude = ('granted', 'granted_date', 'survey_mail_send')
class TravelForm(ModelForm): class TravelForm(FdbForm):
# TODO: add some javascript to show/hide other-field # TODO: add some javascript to show/hide other-field
class Meta: class Meta:
model = Travel model = Travel
@ -53,28 +59,28 @@ class TravelForm(ModelForm):
widgets = {'checkin': AdminDateWidget(), widgets = {'checkin': AdminDateWidget(),
'checkout': AdminDateWidget(),} 'checkout': AdminDateWidget(),}
class LibraryForm(ModelForm): class LibraryForm(FdbForm):
class Meta: class Meta:
model = Library model = Library
fields = ['cost', 'library', 'duration', 'notes'] fields = ['cost', 'library', 'duration', 'notes']
class IFGForm(ModelForm): class IFGForm(FdbForm):
class Meta: class Meta:
model = IFG model = IFG
fields = ['cost', 'url', 'notes'] fields = ['cost', 'url', 'notes']
class HonoraryCertificateForm(ModelForm): class HonoraryCertificateForm(FdbForm):
class Meta: class Meta:
model = HonoraryCertificate model = HonoraryCertificate
fields = ['request_url', 'project'] fields = ['request_url', 'project']
class LiteratureForm(ModelForm): class LiteratureForm(FdbForm):
class Meta: class Meta:
model = Literature model = Literature
fields = ['cost', 'info', 'source', 'notes'] fields = ['cost', 'info', 'source', 'notes']
class EmailForm(ModelForm): class EmailForm(FdbForm):
# TODO: add some javascript to show/hide other-field # TODO: add some javascript to show/hide other-field
check = BooleanField(required=True, check = BooleanField(required=True,
label=format_html("Ich stimme den <a href='{}'>Nutzungsbedingungen</a> zu", label=format_html("Ich stimme den <a href='{}'>Nutzungsbedingungen</a> zu",
@ -84,12 +90,12 @@ class EmailForm(ModelForm):
model = Email model = Email
fields = ['domain', 'address', 'other'] fields = ['domain', 'address', 'other']
class BusinessCardForm(ModelForm): class BusinessCardForm(FdbForm):
class Meta: class Meta:
model = BusinessCard model = BusinessCard
fields = ['project', 'data', 'variant', 'sent_to'] fields = ['project', 'data', 'variant', 'sent_to']
class ListForm(ModelForm): class ListForm(FdbForm):
class Meta: class Meta:
model = List model = List
fields = ['domain', 'address'] fields = ['domain', 'address']

View File

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