Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
6cb458b4
Commit
6cb458b4
authored
Mar 04, 2014
by
Bertrand Marron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Translate gender and education level from user profile
parent
601b5a8c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
14 deletions
+19
-14
common/djangoapps/student/models.py
+15
-10
lms/templates/register.html
+2
-2
lms/templates/signup_modal.html
+2
-2
No files found.
common/djangoapps/student/models.py
View file @
6cb458b4
...
...
@@ -29,6 +29,7 @@ from django.dispatch import receiver, Signal
import
django.dispatch
from
django.forms
import
ModelForm
,
forms
from
django.core.exceptions
import
ObjectDoesNotExist
from
django.utils.translation
import
ugettext_noop
from
django_countries
import
CountryField
from
track
import
contexts
from
track.views
import
server_track
...
...
@@ -189,7 +190,11 @@ class UserProfile(models.Model):
this_year
=
datetime
.
now
(
UTC
)
.
year
VALID_YEARS
=
range
(
this_year
,
this_year
-
120
,
-
1
)
year_of_birth
=
models
.
IntegerField
(
blank
=
True
,
null
=
True
,
db_index
=
True
)
GENDER_CHOICES
=
((
'm'
,
'Male'
),
(
'f'
,
'Female'
),
(
'o'
,
'Other'
))
GENDER_CHOICES
=
(
(
'm'
,
ugettext_noop
(
'Male'
)),
(
'f'
,
ugettext_noop
(
'Female'
)),
(
'o'
,
ugettext_noop
(
'Other'
))
)
gender
=
models
.
CharField
(
blank
=
True
,
null
=
True
,
max_length
=
6
,
db_index
=
True
,
choices
=
GENDER_CHOICES
)
...
...
@@ -199,15 +204,15 @@ class UserProfile(models.Model):
# ('p_se', 'Doctorate in science or engineering'),
# ('p_oth', 'Doctorate in another field'),
LEVEL_OF_EDUCATION_CHOICES
=
(
(
'p'
,
'Doctorate'
),
(
'm'
,
"Master's or professional degree"
),
(
'b'
,
"Bachelor's degree"
),
(
'a'
,
"Associate's degree"
),
(
'hs'
,
"Secondary/high school"
),
(
'jhs'
,
"Junior secondary/junior high/middle school"
),
(
'el'
,
"Elementary/primary school"
),
(
'none'
,
"None"
),
(
'other'
,
"Other"
)
(
'p'
,
ugettext_noop
(
'Doctorate'
)
),
(
'm'
,
ugettext_noop
(
"Master's or professional degree"
)
),
(
'b'
,
ugettext_noop
(
"Bachelor's degree"
)
),
(
'a'
,
ugettext_noop
(
"Associate's degree"
)
),
(
'hs'
,
ugettext_noop
(
"Secondary/high school"
)
),
(
'jhs'
,
ugettext_noop
(
"Junior secondary/junior high/middle school"
)
),
(
'el'
,
ugettext_noop
(
"Elementary/primary school"
)
),
(
'none'
,
ugettext_noop
(
"None"
)
),
(
'other'
,
ugettext_noop
(
"Other"
)
)
)
level_of_education
=
models
.
CharField
(
blank
=
True
,
null
=
True
,
max_length
=
6
,
db_index
=
True
,
...
...
lms/templates/register.html
View file @
6cb458b4
...
...
@@ -210,7 +210,7 @@
<select
id=
"education-level"
name=
"level_of_education"
${'
required
aria-required=
"true"
'
if
settings
.
REGISTRATION_EXTRA_FIELDS
['
level_of_education
']
==
'
required
'
else
''}
>
<option
value=
""
>
--
</option>
%for code, ed_level in UserProfile.LEVEL_OF_EDUCATION_CHOICES:
<option
value=
"${code}"
>
${
ed_level
}
</option>
<option
value=
"${code}"
>
${
_(ed_level)
}
</option>
%endfor
</select>
</div>
...
...
@@ -223,7 +223,7 @@
<select
id=
"gender"
name=
"gender"
${'
required
aria-required=
"true"
'
if
settings
.
REGISTRATION_EXTRA_FIELDS
['
gender
']
==
'
required
'
else
''}
>
<option
value=
""
>
--
</option>
%for code, gender in UserProfile.GENDER_CHOICES:
<option
value=
"${code}"
>
${
gender
}
</option>
<option
value=
"${code}"
>
${
_(gender)
}
</option>
%endfor
</select>
</div>
...
...
lms/templates/signup_modal.html
View file @
6cb458b4
...
...
@@ -71,7 +71,7 @@
<select
id=
"signup_ed_level"
name=
"level_of_education"
>
<option
value=
""
>
--
</option>
%for code, ed_level in UserProfile.LEVEL_OF_EDUCATION_CHOICES:
<option
value=
"${code}"
>
${
ed_level
}
</option>
<option
value=
"${code}"
>
${
_(ed_level)
}
</option>
%endfor
</select>
</div>
...
...
@@ -85,7 +85,7 @@
<select
id=
"signup_gender"
name=
"gender"
>
<option
value=
""
>
--
</option>
%for code, gender in UserProfile.GENDER_CHOICES:
<option
value=
"${code}"
>
${
gender
}
</option>
<option
value=
"${code}"
>
${
_(gender)
}
</option>
%endfor
</select>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment