In my django-admin it is displaying the foreign-key id value instead of the name value of the foreign key. How can I display the actual name value. I tried the str method for my foreignkey model, but doesn't change anything.
class DemoPractice(models.Model):
def __str__(self):
return u'%s' % (self.PracticeName)
Group = models.ForeignKey('DemoGroup', on_delete=models.CASCADE)
PracticeName = models.CharField(max_length=255, null=True, blank=True)
Primary = models.BooleanField(null=False, blank=False, default=True)
ServiceAddressLine1 = models.CharField(max_length=255, help_text='New York', null=True, blank=True)
ServiceAddressLine2 = models.CharField(max_length=255, help_text='New York', null=True, blank=True)
ServiceAddressCity = models.CharField(max_length=255, help_text='New York', null=True, blank=True)
ServiceAddressState = models.CharField(max_length=255, help_text='New York', null=True, blank=True)
ServiceAddressZip = models.CharField(max_length=255, help_text='New York', null=True, blank=True)
ServiceAddressCounty = models.CharField(max_length=255, help_text='10007', null=True, blank=True)
OfficePhone = PhoneField(blank=True, help_text='1234567890 - 10 digits')
OfficeFax = PhoneField(blank=True, help_text='1234567890 - 10 digits')
OfficeEmail = PhoneField(blank=True, help_text='1234567890 - 10 digits')