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
67221b07
Commit
67221b07
authored
Jul 11, 2012
by
Matthew Mongeau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added countries and other demographics to be stored in db.
parent
7e25f39f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
9 deletions
+26
-9
common/djangoapps/student/models.py
+2
-1
common/djangoapps/student/views.py
+6
-4
lms/djangoapps/student/migrations/0011_auto__chg_field_userprofile_country.py
+0
-0
lms/djangoapps/student/migrations/0012_auto__chg_field_userprofile_location.py
+0
-0
lms/templates/signup_modal.html
+18
-4
No files found.
common/djangoapps/student/models.py
View file @
67221b07
...
...
@@ -13,6 +13,7 @@ import uuid
from
django.db
import
models
from
django.contrib.auth.models
import
User
import
json
from
django_countries
import
CountryField
#from cache_toolbox import cache_model, cache_relation
...
...
@@ -34,7 +35,7 @@ class UserProfile(models.Model):
gender
=
models
.
CharField
(
blank
=
True
,
null
=
True
,
max_length
=
6
,
choices
=
GENDER_CHOICES
)
date_of_birth
=
models
.
DateField
(
blank
=
True
,
null
=
True
)
mailing_address
=
models
.
TextField
(
blank
=
True
,
null
=
True
)
country
=
models
.
CharField
(
blank
=
True
,
null
=
True
,
max_length
=
255
)
country
=
CountryField
(
blank
=
True
,
null
=
True
)
telephone_number
=
models
.
CharField
(
blank
=
True
,
null
=
True
,
max_length
=
25
)
occupation
=
models
.
CharField
(
blank
=
True
,
null
=
True
,
max_length
=
255
)
...
...
common/djangoapps/student/views.py
View file @
67221b07
...
...
@@ -169,7 +169,7 @@ def create_account(request, post_override=None):
post_vars
=
post_override
if
post_override
else
request
.
POST
# Confirm we have a properly formed request
for
a
in
[
'username'
,
'email'
,
'password'
,
'l
ocation'
,
'l
anguage'
,
'name'
]:
for
a
in
[
'username'
,
'email'
,
'password'
,
'language'
,
'name'
]:
if
a
not
in
post_vars
:
js
[
'value'
]
=
"Error (401 {field}). E-mail us."
.
format
(
field
=
a
)
return
HttpResponse
(
json
.
dumps
(
js
))
...
...
@@ -235,9 +235,11 @@ def create_account(request, post_override=None):
r
.
register
(
u
)
up
=
UserProfile
(
user
=
u
)
up
.
name
=
post_vars
[
'name'
]
up
.
language
=
post_vars
[
'language'
]
up
.
location
=
post_vars
[
'location'
]
up
.
name
=
post_vars
[
'name'
]
up
.
language
=
post_vars
[
'language'
]
up
.
country
=
post_vars
[
'country'
]
up
.
gender
=
post_vars
[
'gender'
]
up
.
mailing_address
=
post_vars
[
'mailing_address'
]
up
.
save
()
# TODO (vshnayder): the LMS should probably allow signups without a particular course too
...
...
lms/djangoapps/student/migrations/0011_auto__chg_field_userprofile_country.py
0 → 100644
View file @
67221b07
This diff is collapsed.
Click to expand it.
lms/djangoapps/student/migrations/0012_auto__chg_field_userprofile_location.py
0 → 100644
View file @
67221b07
This diff is collapsed.
Click to expand it.
lms/templates/signup_modal.html
View file @
67221b07
<
%
namespace
name=
'static'
file=
'static_content.html'
/>
<
%!
from
django
.
core
.
urlresolvers
import
reverse
%
>
<
%!
from
django_countries
import
countries
%
>
<
%!
from
student
.
models
import
UserProfile
%
>
<section
id=
"signup-modal"
class=
"modal signup-modal"
>
<div
class=
"inner-wrapper"
>
...
...
@@ -21,12 +23,24 @@
<input
name=
"username"
type=
"text"
placeholder=
"Public Username"
>
<label>
Full Name
</label>
<input
name=
"name"
type=
"text"
placeholder=
"Full Name"
>
<label>
Mailing address
</label>
<textarea
name=
"mailing_address"
placeholder=
"Mailing address"
></textarea>
<label>
Country
</label>
<input
name=
"country"
type=
"text"
placeholder=
"Country of citizenship"
>
<p>
<label>
Mailing address
</label>
<textarea
name=
"mailing_address"
placeholder=
"Mailing address"
></textarea>
</p>
<label>
Country of citizenship
</label>
<select
name=
"country"
>
%for code, country in countries.COUNTRIES:
<option
value=
"${code}"
>
${country}
</option>
%endfor
</select>
<label>
Preferred Language
</label>
<input
name=
"language"
type=
"text"
placeholder=
"Preferred Language"
>
<label>
Gender
</label>
<select
name=
"gender"
>
%for code, gender in UserProfile.GENDER_CHOICES:
<option
value=
"${code}"
>
${gender}
</option>
%endfor
</select>
<label
class=
"terms-of-service"
>
<input
name=
"terms_of_service"
type=
"checkbox"
value=
"true"
>
I agree to the
...
...
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