From 46d8caa8cd624850b1d6e56dd9af4381fd54b441 Mon Sep 17 00:00:00 2001 From: Troy Sankey Date: Thu, 5 Oct 2017 13:47:55 -0400 Subject: [PATCH] Remove/update comments related to django 1.4 Course keys as PKs don't appear to break detail links in admin pages anymore. --- .../core/djangoapps/content/course_overviews/admin.py | 10 ---------- .../course_overviews/tests/test_course_overviews.py | 9 ++++----- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/openedx/core/djangoapps/content/course_overviews/admin.py b/openedx/core/djangoapps/content/course_overviews/admin.py index 7b1c90355a..7cf362b898 100644 --- a/openedx/core/djangoapps/content/course_overviews/admin.py +++ b/openedx/core/djangoapps/content/course_overviews/admin.py @@ -12,16 +12,6 @@ from .models import CourseOverview, CourseOverviewImageConfig, CourseOverviewIma class CourseOverviewAdmin(admin.ModelAdmin): """ Simple, read-only list/search view of Course Overviews. - - The detail view is broken because our primary key for this model are - course keys, which can have a number of chars that break admin URLs. - There's probably a way to make this work properly, but I don't have the - time to investigate. I would normally disable the links by setting - `list_display_links = None`, but that's not a valid value for that - field in Django 1.4. So I'm left with creating a page where the detail - view links are all broken for Split courses. Because I only created - this page to manually test a hotfix, the list view works for this - purpose, and that's all the yak I have time to shave today. """ list_display = [ 'id', diff --git a/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py b/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py index 92537f08d2..c42f285f77 100644 --- a/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py +++ b/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py @@ -355,11 +355,10 @@ class CourseOverviewTestCase(ModuleStoreTestCase): 'openedx.core.djangoapps.content.course_overviews.models.CourseOverview._get_pk_val' ) as mock_get_pk_val: mock_get_pk_val.return_value = None - # This method was not present in django 1.4. Django 1.8 calls this method if - # _get_pk_val returns None. This method will return empty str if there is no - # default value present. So mock it to avoid returning the empty str as primary key - # value. Due to empty str, model.save will do an update instead of insert which is - # incorrect and get exception in + # Django 1.8+ calls this method if _get_pk_val returns None. This method will + # return empty str if there is no default value present. So mock it to avoid + # returning the empty str as primary key value. Due to empty str, model.save will do + # an update instead of insert which is incorrect and get exception in # openedx.core.djangoapps.xmodule_django.models.OpaqueKeyField.get_prep_value with mock.patch('django.db.models.Field.get_pk_value_on_save') as mock_get_pk_value_on_save: