Skip to content
Snippets Groups Projects
Commit e9714148 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

default order of subject field added

parent 5250e41a
No related branches found
No related tags found
1 merge request!103Resolve "subject should have social security number"
Pipeline #
from django import forms
from django.forms import ModelForm
from web.forms.forms import DATEPICKER_DATE_ATTRS
from web.models import Subject
from web.models.constants import COUNTRY_OTHER_ID
from web.forms.forms import DATEPICKER_DATE_ATTRS
def validate_subject_country(self, cleaned_data):
......@@ -11,12 +11,19 @@ def validate_subject_country(self, cleaned_data):
self.add_error('country', "Select valid country")
FIELD_ORDER = ["first_name", "last_name", "sex", "date_born", "social_security_number",
"default_written_communication_language", "languages", "phone_number", "phone_number_2",
"phone_number_3", "address", "city", "postal_code", "country"]
class SubjectAddForm(ModelForm):
date_born = forms.DateField(label="Date of birth",
widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"),
required=False
)
field_order = FIELD_ORDER
class Meta:
model = Subject
fields = '__all__'
......@@ -34,6 +41,8 @@ class SubjectEditForm(ModelForm):
required=False
)
field_order = FIELD_ORDER
def __init__(self, *args, **kwargs):
was_dead = kwargs.get('was_dead', False)
if 'was_dead' in kwargs:
......@@ -51,6 +60,8 @@ class SubjectEditForm(ModelForm):
class SubjectDetailForm(ModelForm):
field_order = FIELD_ORDER
class Meta:
model = Subject
fields = '__all__'
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