'Ensure that the "View on Site" link is correct for models with a
custom primary key field. Bug #18433.'

def test_custom_pk_shortcut(self):

    parent = ParentModelWithCustomPk.objects.create(my_own_pk=u'foo', name=u'Foo')
    child1 = ChildModel1.objects.create(my_own_pk=u'bar', name=u'Bar', parent=parent)
    child2 = ChildModel2.objects.create(my_own_pk=u'baz', name=u'Baz', parent=parent)
    response = self.client.get(u'/admin/admin_inlines/parentmodelwithcustompk/foo/')
    child1_shortcut = (u'r/%s/%s/' % (ContentType.objects.get_for_model(child1).pk, child1.pk))
    child2_shortcut = (u'r/%s/%s/' % (ContentType.objects.get_for_model(child2).pk, child2.pk))
    self.assertContains(response, child1_shortcut)
    self.assertContains(response, child2_shortcut)
