Skip to content

Commit

Permalink
Fixed #12349: Added missing unquote in admin history view. Thanks for…
Browse files Browse the repository at this point in the history
… the report guard.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11808 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
kmtracey committed Dec 10, 2009
1 parent 9bf652d commit 5543b10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion django/contrib/admin/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ def history_view(self, request, object_id, extra_context=None):
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,
Expand Down
6 changes: 6 additions & 0 deletions tests/regressiontests/admin_views/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,12 @@ def setUp(self):
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))
Expand Down

0 comments on commit 5543b10

Please sign in to comment.