Commit d26330be by Matthew Mongeau

Add date_of_birth

parent bbf6a517
...@@ -31,6 +31,8 @@ from xmodule.course_module import CourseDescriptor ...@@ -31,6 +31,8 @@ from xmodule.course_module import CourseDescriptor
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError from xmodule.modulestore.exceptions import ItemNotFoundError
from models import Registration, UserProfile, PendingNameChange, PendingEmailChange, CourseEnrollment
from datetime import date
log = logging.getLogger("mitx.student") log = logging.getLogger("mitx.student")
...@@ -240,6 +242,13 @@ def create_account(request, post_override=None): ...@@ -240,6 +242,13 @@ def create_account(request, post_override=None):
up.country = post_vars['country'] up.country = post_vars['country']
up.gender = post_vars['gender'] up.gender = post_vars['gender']
up.mailing_address = post_vars['mailing_address'] up.mailing_address = post_vars['mailing_address']
date_fields = ['date_of_birth__year', 'date_of_birth__month', 'date_of_birth__day']
if all(len(post_vars[field]) > 0 for field in date_fields):
up.date_of_birth = date(int(post_vars['date_of_birth__year']),
int(post_vars['date_of_birth__month']),
int(post_vars['date_of_birth__day']))
up.save() up.save()
# TODO (vshnayder): the LMS should probably allow signups without a particular course too # TODO (vshnayder): the LMS should probably allow signups without a particular course too
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<%! from django.core.urlresolvers import reverse %> <%! from django.core.urlresolvers import reverse %>
<%! from django_countries.countries import COUNTRIES %> <%! from django_countries.countries import COUNTRIES %>
<%! from student.models import UserProfile %> <%! from student.models import UserProfile %>
<%! from datetime import date %>
<section id="signup-modal" class="modal signup-modal"> <section id="signup-modal" class="modal signup-modal">
<div class="inner-wrapper"> <div class="inner-wrapper">
...@@ -41,6 +42,22 @@ ...@@ -41,6 +42,22 @@
<option value="${code}">${gender}</option> <option value="${code}">${gender}</option>
%endfor %endfor
</select> </select>
<label>Date of birth</label>
<select name='date_of_birth__month'>
%for month in range(1,13):
<option value="${month}">${month}</option>
%endfor
</select>
<select name='date_of_birth__day'>
%for day in range(1,32):
<option value="${day}">${day}</option>
%endfor
</select>
<select name='date_of_birth__year'>
%for year in range(date.today().year,1899,-1):
<option value="${year}">${year}</option>
%endfor
</select>
<label class="terms-of-service"> <label class="terms-of-service">
<input name="terms_of_service" type="checkbox" value="true"> <input name="terms_of_service" type="checkbox" value="true">
I agree to the I agree to the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment