Ticket #10223: 10223-test.diff

File 10223-test.diff, 1.4 KB (added by mmarshall, 16 years ago)
  • tests/regressiontests/admin_views/tests.py

     
    231231            "Changelist filter isn't showing options contained inside a model field 'choices' option named group."
    232232        )
    233233
     234    def test_shortcut_with_slash(self):
     235        obj = ModelWithStringPrimaryKey.objects.create(id="pk/with/slashes")
     236        short_url = '/test_admin/admin2/r/%s/%s/' % (ContentType.objects.get_for_model(ModelWithStringPrimaryKey).id, obj.pk)
     237        response = self.client.get(short_url)
     238        self.assertRedirects(response, 'http://example.com%s' % obj.get_absolute_url(),
     239                             status_code=302, target_status_code=404)
     240
    234241class CustomModelAdminTest(AdminViewBasicTest):
    235242    urlbit = "admin2"
    236243
  • tests/regressiontests/admin_views/models.py

     
    119119
    120120    def __unicode__(self):
    121121        return self.id
     122   
     123    def get_absolute_url(self):
     124        return "/"+self.id
    122125
    123126class Color(models.Model):
    124127    value = models.CharField(max_length=10)
Back to Top