Commit dd0cd57e by Matthew Mongeau

Add date_of_birth

parent 456054a2
......@@ -31,6 +31,8 @@ from xmodule.course_module import CourseDescriptor
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError
from models import Registration, UserProfile, PendingNameChange, PendingEmailChange, CourseEnrollment
from datetime import date
log = logging.getLogger("mitx.student")
......@@ -240,6 +242,13 @@ def create_account(request, post_override=None):
up.country = post_vars['country']
up.gender = post_vars['gender']
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()
# TODO (vshnayder): the LMS should probably allow signups without a particular course too
......
......@@ -2,6 +2,7 @@
<%! from django.core.urlresolvers import reverse %>
<%! from django_countries.countries import COUNTRIES %>
<%! from student.models import UserProfile %>
<%! from datetime import date %>
<section id="signup-modal" class="modal signup-modal">
<div class="inner-wrapper">
......@@ -41,6 +42,22 @@
<option value="${code}">${gender}</option>
%endfor
</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">
<input name="terms_of_service" type="checkbox" value="true">
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