Lets say I have models:
class Foo(models.Model):
name = models.CharField(max_length=128)
def __unicode__(self):
return self.name
class Bar(models.Model):
foo = models.ForeignKey(Foo)
Now if I go to django Bar's admin, I get dropdown field with Foo's names. I know that name comes from __unicode__
function in Foo
class. How can I change that name displayed in admin? I don't want to modify my __unicode__
function. I would prefer something like:
class Foo(models.Model):
....
def unicode_for_admin_display(self):
return 'some words ' + self.name