Loading django/contrib/admin/templatetags/admin_list.py +3 −3 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ from django.contrib.admin.templatetags.admin_static import static from django.core.exceptions import ObjectDoesNotExist from django.db import models from django.utils import formats from django.utils.html import format_html from django.utils.html import escapejs, format_html from django.utils.safestring import mark_safe from django.utils.text import capfirst from django.utils.translation import ugettext as _ Loading Loading @@ -226,12 +226,12 @@ def items_for_result(cl, result, form): else: attr = pk value = result.serializable_value(attr) result_id = repr(force_text(value))[1:] result_id = escapejs(value) yield format_html('<{0}{1}><a href="{2}"{3}>{4}</a></{5}>', table_tag, row_class, url, format_html(' onclick="opener.dismissRelatedLookupPopup(window, {0}); return false;"', result_id) format_html(' onclick="opener.dismissRelatedLookupPopup(window, '{0}'); return false;"', result_id) if cl.is_popup else '', result_repr, table_tag) Loading tests/admin_views/tests.py +8 −0 Original line number Diff line number Diff line Loading @@ -583,6 +583,14 @@ class AdminViewBasicTest(TestCase): response = self.client.get("/test_admin/admin/admin_views/inquisition/?leader__name=Palin&leader__age=27") self.assertEqual(response.status_code, 200) def test_popup_dismiss_related(self): """ Regression test for ticket 20664 - ensure the pk is properly quoted. """ actor = Actor.objects.create(name="Palin", age=27) response = self.client.get("/test_admin/admin/admin_views/actor/?%s" % IS_POPUP_VAR) self.assertContains(response, "opener.dismissRelatedLookupPopup(window, '%s')" % actor.pk) def test_hide_change_password(self): """ Tests if the "change password" link in the admin is hidden if the User Loading Loading
django/contrib/admin/templatetags/admin_list.py +3 −3 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ from django.contrib.admin.templatetags.admin_static import static from django.core.exceptions import ObjectDoesNotExist from django.db import models from django.utils import formats from django.utils.html import format_html from django.utils.html import escapejs, format_html from django.utils.safestring import mark_safe from django.utils.text import capfirst from django.utils.translation import ugettext as _ Loading Loading @@ -226,12 +226,12 @@ def items_for_result(cl, result, form): else: attr = pk value = result.serializable_value(attr) result_id = repr(force_text(value))[1:] result_id = escapejs(value) yield format_html('<{0}{1}><a href="{2}"{3}>{4}</a></{5}>', table_tag, row_class, url, format_html(' onclick="opener.dismissRelatedLookupPopup(window, {0}); return false;"', result_id) format_html(' onclick="opener.dismissRelatedLookupPopup(window, '{0}'); return false;"', result_id) if cl.is_popup else '', result_repr, table_tag) Loading
tests/admin_views/tests.py +8 −0 Original line number Diff line number Diff line Loading @@ -583,6 +583,14 @@ class AdminViewBasicTest(TestCase): response = self.client.get("/test_admin/admin/admin_views/inquisition/?leader__name=Palin&leader__age=27") self.assertEqual(response.status_code, 200) def test_popup_dismiss_related(self): """ Regression test for ticket 20664 - ensure the pk is properly quoted. """ actor = Actor.objects.create(name="Palin", age=27) response = self.client.get("/test_admin/admin/admin_views/actor/?%s" % IS_POPUP_VAR) self.assertContains(response, "opener.dismissRelatedLookupPopup(window, '%s')" % actor.pk) def test_hide_change_password(self): """ Tests if the "change password" link in the admin is hidden if the User Loading