Reputation: 31548
I am using this in my Model
bank = models.ForeignKey(Bank)
But in my editable form I have the select box but the values which appear is like
Bank object
Is there any option so I can see field like Bank.name
in select box
Upvotes: 0
Views: 184
Reputation: 4012
define a unicode method for Bank class like below:
def __unicode__(self):
return self.name
Upvotes: 1
Reputation: 187994
By overriding the __unicode__
method of your Bank
class, you can provide alternative display values for your model instances.
class Bank(models.Model):
...
def __unicode__(self):
return unicode(self.name)
Upvotes: 1