From e5ca564062c863cb2c50eab7905e42426e7a3d41 Mon Sep 17 00:00:00 2001 From: "N. Geisler" <ngeisler@fachschaft.informatik.tu-darmstadt.de> Date: Fri, 25 Oct 2019 14:10:08 +0200 Subject: [PATCH] highlight required fields in forms in bold --- AKSubmission/forms.py | 11 +++++++---- static_common/common/css/custom.css | 3 +++ templates/base.html | 2 ++ 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 static_common/common/css/custom.css diff --git a/AKSubmission/forms.py b/AKSubmission/forms.py index 1529a661..3bf2bd64 100644 --- a/AKSubmission/forms.py +++ b/AKSubmission/forms.py @@ -1,12 +1,13 @@ from django import forms from django.core.exceptions import ValidationError +from django.utils.translation import ugettext_lazy as _ from AKModel.models import AK, AKOwner -from django.utils.translation import ugettext_lazy as _ - class AKForm(forms.ModelForm): + required_css_class = 'required' + class Meta: model = AK fields = ['name', @@ -83,7 +84,6 @@ class AKForm(forms.ModelForm): class AKSubmissionForm(AKForm): - class Meta(AKForm.Meta): exclude = ['link'] @@ -93,7 +93,8 @@ class AKSubmissionForm(AKForm): self.fields["durations"] = forms.CharField( widget=forms.Textarea, label=_("Duration(s)"), - help_text=_("Enter at least one planned duration (in hours). If your AK should have multiple slots, use multiple lines") + help_text=_( + "Enter at least one planned duration (in hours). If your AK should have multiple slots, use multiple lines") ) @@ -112,6 +113,8 @@ class AKWishForm(AKSubmissionForm): class AKOwnerForm(forms.ModelForm): + required_css_class = 'required' + class Meta: model = AKOwner fields = ['name', 'email', 'institution', 'link'] diff --git a/static_common/common/css/custom.css b/static_common/common/css/custom.css new file mode 100644 index 00000000..3f26ff56 --- /dev/null +++ b/static_common/common/css/custom.css @@ -0,0 +1,3 @@ +.form-group.required { + font-weight: bold; +} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index 412b6109..ad0c138a 100644 --- a/templates/base.html +++ b/templates/base.html @@ -14,6 +14,8 @@ {% bootstrap_javascript jquery='slim' %} {% fontawesome_stylesheet %} + <link rel="stylesheet" href="{% static 'common/css/custom.css' %}"> + {% block imports %}{% endblock %} </head> <body> -- GitLab