Remove/update comments related to django 1.4
Course keys as PKs don't appear to break detail links in admin pages anymore.
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user