Skip to content
Snippets Groups Projects
Commit e5ca5640 authored by Nadja Geisler's avatar Nadja Geisler :sunny:
Browse files

highlight required fields in forms in bold

parent 3ddf2458
No related branches found
No related tags found
No related merge requests found
from django import forms from django import forms
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from AKModel.models import AK, AKOwner from AKModel.models import AK, AKOwner
from django.utils.translation import ugettext_lazy as _
class AKForm(forms.ModelForm): class AKForm(forms.ModelForm):
required_css_class = 'required'
class Meta: class Meta:
model = AK model = AK
fields = ['name', fields = ['name',
...@@ -83,7 +84,6 @@ class AKForm(forms.ModelForm): ...@@ -83,7 +84,6 @@ class AKForm(forms.ModelForm):
class AKSubmissionForm(AKForm): class AKSubmissionForm(AKForm):
class Meta(AKForm.Meta): class Meta(AKForm.Meta):
exclude = ['link'] exclude = ['link']
...@@ -93,7 +93,8 @@ class AKSubmissionForm(AKForm): ...@@ -93,7 +93,8 @@ class AKSubmissionForm(AKForm):
self.fields["durations"] = forms.CharField( self.fields["durations"] = forms.CharField(
widget=forms.Textarea, widget=forms.Textarea,
label=_("Duration(s)"), 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): ...@@ -112,6 +113,8 @@ class AKWishForm(AKSubmissionForm):
class AKOwnerForm(forms.ModelForm): class AKOwnerForm(forms.ModelForm):
required_css_class = 'required'
class Meta: class Meta:
model = AKOwner model = AKOwner
fields = ['name', 'email', 'institution', 'link'] fields = ['name', 'email', 'institution', 'link']
.form-group.required {
font-weight: bold;
}
\ No newline at end of file
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
{% bootstrap_javascript jquery='slim' %} {% bootstrap_javascript jquery='slim' %}
{% fontawesome_stylesheet %} {% fontawesome_stylesheet %}
<link rel="stylesheet" href="{% static 'common/css/custom.css' %}">
{% block imports %}{% endblock %} {% block imports %}{% endblock %}
</head> </head>
<body> <body>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment