Add date_of_birth
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user