The default choice field display of a reference property in appengine returns the choices as the string representation of the entire object. What is the best method to override this behaviour? I tried to override str() in the referenced class. But it does not work.
views:
120answers:
2
+1
Q:
How do we override the choice field display of a reference property in appengine using Django?
+1
A:
I got it to work by overriding the init method of the modelform to pick up the correct fields as I had to do filtering of the choices as well.
Sriram
2009-10-28 11:33:59
A:
The correct way would be to override the __unicode__
method of the class, like:
def __unicode__(self):
return self.name
where name
is the value that you want to display.
Randell
2010-03-16 14:44:54
That is correct. I think my scenario was a bit different and I don't remember now.
Sriram
2010-03-17 11:01:37