Commit 79d8d683 authored by Karen Tracey's avatar Karen Tracey
Browse files

[1.1.X] Fixed #12349: Added missing unquote in admin history view. Thanks for the report guard.

r11808 from trunk.


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@11809 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent 58c19c32
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1052,7 +1052,7 @@ class ModelAdmin(BaseModelAdmin):
            content_type__id__exact = ContentType.objects.get_for_model(model).id
        ).select_related().order_by('action_time')
        # If no history was found, see whether this object even exists.
        obj = get_object_or_404(model, pk=object_id)
        obj = get_object_or_404(model, pk=unquote(object_id))
        context = {
            'title': _('Change history: %s') % force_unicode(obj),
            'action_list': action_list,
+6 −0
Original line number Diff line number Diff line
@@ -610,6 +610,12 @@ class AdminViewStringPrimaryKeyTest(TestCase):
    def tearDown(self):
        self.client.logout()

    def test_get_history_view(self):
        "Retrieving the history for the object using urlencoded form of primary key should work"
        response = self.client.get('/test_admin/admin/admin_views/modelwithstringprimarykey/%s/history/' % quote(self.pk))
        self.assertContains(response, escape(self.pk))
        self.failUnlessEqual(response.status_code, 200)
 
    def test_get_change_view(self):
        "Retrieving the object using urlencoded form of primary key should work"
        response = self.client.get('/test_admin/admin/admin_views/modelwithstringprimarykey/%s/' % quote(self.pk))