From 4b1875eaeb7b399090310ac36f74ba8cba340e76 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Wed, 13 Jan 2021 14:17:21 +0100 Subject: [PATCH] mark required fields with red stars --- evapp/forms.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/evapp/forms.py b/evapp/forms.py index bf0ffc9..01fe604 100644 --- a/evapp/forms.py +++ b/evapp/forms.py @@ -10,12 +10,16 @@ from .models import Employee # widgets = {'firstdate_employment': DateInput(attrs={'type': 'date'}), # 'firstdate_presence': DateInput(attrs={'type': 'date'}),} -class PersonalForm(ModelForm): +class FdbForm(ModelForm): + '''this base class provides the required css class for all forms''' + required_css_class = 'required' + +class PersonalForm(FdbForm): class Meta: model = Employee fields = ['firstname', 'lastname', 'email', 'department', 'team',] -class WorkingForm(ModelForm): +class WorkingForm(FdbForm): class Meta: model = Employee fields = ['firstdate_employment', 'firstdate_presence', 'jobdescription_german', @@ -23,14 +27,14 @@ class WorkingForm(ModelForm): widgets = {'firstdate_employment': DateInput(attrs={'type': 'date'}), 'firstdate_presence': DateInput(attrs={'type': 'date'}),} -class ITForm(ModelForm): +class ITForm(FdbForm): class Meta: model = Employee fields = [ 'laptop', 'os', 'screen', 'mobile', 'landline', 'comment', 'language', 'accounts', 'lists', ] -class OfficeForm(ModelForm): +class OfficeForm(FdbForm): class Meta: model = Employee fields = ['transponder', 'post_office_box',]