[Answer]-How to get Django Admin to display a field connected with a foreign key?

1👍

I would structure my models as such:

class Aim(models.Model):
     code = models.CharField(max_length=5)

     def __unicode__(self):
         return self.code

class AnotherAim(models.Model):
    email = models.EmailField(blank=True)
    name = models.CharField(max_length=100)
    sur_name = models.CharField(max_length=100)
    aim = models.OneToOneField(Aim, null=True)

    def __unicode__(self):
        return self.name  # or another field

Leave a comment