Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scheduling-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SMASCH
scheduling-system
Commits
346e843c
Commit
346e843c
authored
6 years ago
by
Carlos Vega
Browse files
Options
Downloads
Patches
Plain Diff
format
parent
022aab6c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!178
Feature/import data pdp
Pipeline
#7250
failed
6 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
smash/web/forms/subject_forms.py
+5
-14
5 additions, 14 deletions
smash/web/forms/subject_forms.py
with
5 additions
and
14 deletions
smash/web/forms/subject_forms.py
+
5
−
14
View file @
346e843c
...
@@ -18,8 +18,7 @@ def validate_subject_country(self, cleaned_data):
...
@@ -18,8 +18,7 @@ def validate_subject_country(self, cleaned_data):
def
validate_social_security_number
(
self
,
number
):
def
validate_social_security_number
(
self
,
number
):
if
not
is_valid_social_security_number
(
number
):
if
not
is_valid_social_security_number
(
number
):
self
.
add_error
(
'
social_security_number
'
,
self
.
add_error
(
'
social_security_number
'
,
"
Social security number is invalid
"
)
"
Social security number is invalid
"
)
FIELD_ORDER
=
[
"
first_name
"
,
"
last_name
"
,
"
sex
"
,
"
date_born
"
,
"
social_security_number
"
,
FIELD_ORDER
=
[
"
first_name
"
,
"
last_name
"
,
"
sex
"
,
"
date_born
"
,
"
social_security_number
"
,
"
default_written_communication_language
"
,
"
languages
"
,
"
phone_number
"
,
"
phone_number_2
"
,
"
default_written_communication_language
"
,
"
languages
"
,
"
phone_number
"
,
"
phone_number_2
"
,
...
@@ -28,10 +27,7 @@ FIELD_ORDER = ["first_name", "last_name", "sex", "date_born", "social_security_n
...
@@ -28,10 +27,7 @@ FIELD_ORDER = ["first_name", "last_name", "sex", "date_born", "social_security_n
class
SubjectAddForm
(
ModelForm
):
class
SubjectAddForm
(
ModelForm
):
date_born
=
forms
.
DateField
(
label
=
"
Date of birth
"
,
date_born
=
forms
.
DateField
(
label
=
"
Date of birth
"
,
widget
=
forms
.
DateInput
(
widget
=
forms
.
DateInput
(
DATEPICKER_DATE_ATTRS
,
"
%Y-%m-%d
"
),
required
=
False
)
DATEPICKER_DATE_ATTRS
,
"
%Y-%m-%d
"
),
required
=
False
)
field_order
=
FIELD_ORDER
field_order
=
FIELD_ORDER
...
@@ -43,17 +39,13 @@ class SubjectAddForm(ModelForm):
...
@@ -43,17 +39,13 @@ class SubjectAddForm(ModelForm):
def
clean
(
self
):
def
clean
(
self
):
cleaned_data
=
super
(
SubjectAddForm
,
self
).
clean
()
cleaned_data
=
super
(
SubjectAddForm
,
self
).
clean
()
validate_subject_country
(
self
,
cleaned_data
)
validate_subject_country
(
self
,
cleaned_data
)
validate_social_security_number
(
validate_social_security_number
(
self
,
cleaned_data
[
"
social_security_number
"
])
self
,
cleaned_data
[
"
social_security_number
"
])
return
cleaned_data
return
cleaned_data
class
SubjectEditForm
(
ModelForm
):
class
SubjectEditForm
(
ModelForm
):
date_born
=
forms
.
DateField
(
label
=
"
Date of birth
"
,
date_born
=
forms
.
DateField
(
label
=
"
Date of birth
"
,
widget
=
forms
.
DateInput
(
widget
=
forms
.
DateInput
(
DATEPICKER_DATE_ATTRS
,
"
%Y-%m-%d
"
),
required
=
False
)
DATEPICKER_DATE_ATTRS
,
"
%Y-%m-%d
"
),
required
=
False
)
field_order
=
FIELD_ORDER
field_order
=
FIELD_ORDER
...
@@ -67,8 +59,7 @@ class SubjectEditForm(ModelForm):
...
@@ -67,8 +59,7 @@ class SubjectEditForm(ModelForm):
def
clean
(
self
):
def
clean
(
self
):
validate_subject_country
(
self
,
self
.
cleaned_data
)
validate_subject_country
(
self
,
self
.
cleaned_data
)
validate_social_security_number
(
validate_social_security_number
(
self
,
self
.
cleaned_data
[
"
social_security_number
"
])
self
,
self
.
cleaned_data
[
"
social_security_number
"
])
class
Meta
:
class
Meta
:
model
=
Subject
model
=
Subject
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment