Commit c01da157 by attiyaishaque Committed by Attiya Ishaque

Fix that when course start date is null it wouldn't raises error.

parent 7699883d
...@@ -3262,6 +3262,11 @@ class CourseEditViewTests(SiteMixin, TestCase): ...@@ -3262,6 +3262,11 @@ class CourseEditViewTests(SiteMixin, TestCase):
response = self.client.post(self.edit_page_url, data=post_data) response = self.client.post(self.edit_page_url, data=post_data)
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
# Verify that when start date is None it didn't raise server error
self.course.course_runs.update(start=None)
response = self.client.post(self.edit_page_url, data=post_data)
self.assertEqual(response.status_code, 302)
# Failure case # Failure case
post_data = self._post_data(self.organization_extension) post_data = self._post_data(self.organization_extension)
post_data['team_admin'] = self.course_team_role.user.id post_data['team_admin'] = self.course_team_role.user.id
......
...@@ -430,9 +430,10 @@ class CourseEditView(mixins.PublisherPermissionMixin, UpdateView): ...@@ -430,9 +430,10 @@ class CourseEditView(mixins.PublisherPermissionMixin, UpdateView):
published_runs = set() published_runs = set()
for course_run in self._get_active_course_runs(course): for course_run in self._get_active_course_runs(course):
if course_run.course_run_state.is_published: if course_run.course_run_state.is_published:
start_date = course_run.start.strftime("%B %d, %Y") if course_run.start else None
published_runs.add('{type} - {start}'.format( published_runs.add('{type} - {start}'.format(
type=course_run.get_pacing_type_display(), type=course_run.get_pacing_type_display(),
start=course_run.start.strftime("%B %d, %Y") start=start_date
)) ))
return published_runs return published_runs
......
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