1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #18550 -- Ensured that the admin history view works with escaped primary keys.

Thanks to josh.oosterman for the report and patch.
This commit is contained in:
Julien Phalip
2012-07-01 18:40:50 -07:00
parent 7313468f85
commit 2cd4cf58d3
2 changed files with 8 additions and 3 deletions

View File

@@ -1344,15 +1344,20 @@ class AdminViewStringPrimaryKeyTest(TestCase):
def setUp(self):
self.client.login(username='super', password='secret')
content_type_pk = ContentType.objects.get_for_model(ModelWithStringPrimaryKey).pk
LogEntry.objects.log_action(100, content_type_pk, self.pk, self.pk, 2, change_message='')
LogEntry.objects.log_action(100, content_type_pk, self.pk, self.pk, 2, change_message='Changed something')
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"
"""
Retrieving the history for an object using urlencoded form of primary
key should work.
Refs #12349, #18550.
"""
response = self.client.get('/test_admin/admin/admin_views/modelwithstringprimarykey/%s/history/' % quote(self.pk))
self.assertContains(response, escape(self.pk))
self.assertContains(response, 'Changed something')
self.assertEqual(response.status_code, 200)
def test_get_change_view(self):