1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #18433 -- Fixed "View on Site" link in inline admin for models with custom PK

This commit is contained in:
Daniel Hepper
2012-06-07 19:52:13 +02:00
parent 6a66fc08b3
commit 0ae727beda
5 changed files with 55 additions and 4 deletions

View File

@@ -139,6 +139,31 @@ class SottoCapo(models.Model):
name = models.CharField(max_length=100)
capo_famiglia = models.ForeignKey(CapoFamiglia, related_name='+')
# Models for #18433
class ParentModelWithCustomPk(models.Model):
my_own_pk = models.CharField(max_length=100, primary_key=True)
name = models.CharField(max_length=100)
class ChildModel1(models.Model):
my_own_pk = models.CharField(max_length=100, primary_key=True)
name = models.CharField(max_length=100)
parent = models.ForeignKey(ParentModelWithCustomPk)
def get_absolute_url(self):
return '/child_model1/'
class ChildModel2(models.Model):
my_own_pk = models.CharField(max_length=100, primary_key=True)
name = models.CharField(max_length=100)
parent = models.ForeignKey(ParentModelWithCustomPk)
def get_absolute_url(self):
return '/child_model2/'
# Other models
class ProfileCollection(models.Model):