diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index 4fb929f501..6aeebfe2e6 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -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 diff --git a/lms/templates/signup_modal.html b/lms/templates/signup_modal.html index 2bf3497127..7e2394af85 100644 --- a/lms/templates/signup_modal.html +++ b/lms/templates/signup_modal.html @@ -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 %>