Ticket #17200: 17200-patch-and-test.diff
File 17200-patch-and-test.diff, 2.6 KB (added by , 13 years ago) |
---|
-
django/contrib/admin/options.py
1088 1088 context = { 1089 1089 'title': _('Change %s') % force_unicode(opts.verbose_name), 1090 1090 'adminform': adminForm, 1091 'object_id': object_id,1091 'object_id': unquote(object_id), 1092 1092 'original': obj, 1093 1093 'is_popup': "_popup" in request.REQUEST, 1094 1094 'media': mark_safe(media), -
tests/regressiontests/admin_views/tests.py
14 14 from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME 15 15 from django.contrib.admin.models import LogEntry, DELETION 16 16 from django.contrib.admin.sites import LOGIN_FORM_KEY 17 from django.contrib.admin.util import quote 17 from django.contrib.admin.util import quote, unquote 18 18 from django.contrib.admin.views.main import IS_POPUP_VAR 19 19 from django.contrib.auth import REDIRECT_FIELD_NAME, admin 20 20 from django.contrib.auth.models import Group, User, Permission, UNUSABLE_PASSWORD … … 1206 1206 response = self.client.get('/test_admin/admin/admin_views/modelwithstringprimarykey/%s/' % quote(self.pk)) 1207 1207 self.assertContains(response, escape(self.pk)) 1208 1208 self.assertEqual(response.status_code, 200) 1209 content_type_pk = ContentType.objects.get_for_model(ModelWithStringPrimaryKey).pk 1210 should_contain = """<a href="../../../r/%s/%s/" class="viewsitelink">View on site</a>""" % (content_type_pk, escape(self.pk)) 1211 self.assertContains(response, should_contain) 1209 1212 1210 1213 def test_changelist_to_changeform_link(self): 1211 1214 "The link from the changelist referring to the changeform of the object should be quoted" -
tests/regressiontests/admin_views/models.py
99 99 def __unicode__(self): 100 100 return self.id 101 101 102 def get_absolute_url(self): 103 # Need this to cause "view on site" link to appear on admin change form. 104 # We're not testing the specific URL produced by this method. 105 return '/%s/' % self.id 102 106 107 103 108 class Color(models.Model): 104 109 value = models.CharField(max_length=10) 105 110 warm = models.BooleanField()