diff --git a/lms/djangoapps/pocs/views.py b/lms/djangoapps/pocs/views.py index 62711aeb79..5d4bd4fa32 100644 --- a/lms/djangoapps/pocs/views.py +++ b/lms/djangoapps/pocs/views.py @@ -231,6 +231,22 @@ def set_grading_policy(request, course): return redirect(url) +def validate_date(year, month, day, hour, minute): + # avoid corrupting db if bad dates come in + valid = True + if year < 0: + valid = False + if month < 1 or month > 12: + valid = False + if day < 1 or day > 31: + valid = False + if hour < 0 or hour > 23: + valid = False + if minute < 0 or minute > 59: + valid = False + return valid + + def parse_date(datestring): """ Generate a UTC datetime.datetime object from a string of the form @@ -240,8 +256,9 @@ def parse_date(datestring): date, time = datestring.split(' ') year, month, day = map(int, date.split('-')) hour, minute = map(int, time.split(':')) - return datetime.datetime( - year, month, day, hour, minute, tzinfo=pytz.UTC) + if validate_date(year, month, day, hour, minute): + return datetime.datetime( + year, month, day, hour, minute, tzinfo=pytz.UTC) return None diff --git a/lms/templates/pocs/coach_dashboard.html b/lms/templates/pocs/coach_dashboard.html index 1fb6e8f6d8..7f19666e02 100644 --- a/lms/templates/pocs/coach_dashboard.html +++ b/lms/templates/pocs/coach_dashboard.html @@ -14,6 +14,16 @@ <%static:css group='style-course'/> %block> +<%block name="jsextra"> + + + +%block> + <%include file="/courseware/course_navigation.html" args="active_page='poc_coach'" /> diff --git a/lms/templates/pocs/schedule.html b/lms/templates/pocs/schedule.html index 94788a7c6d..4e443a5c8a 100644 --- a/lms/templates/pocs/schedule.html +++ b/lms/templates/pocs/schedule.html @@ -70,10 +70,10 @@ - + - - + + ${_('Set date')} @@ -138,6 +138,15 @@