1

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.

Randell
  • 6,112
  • 6
  • 45
  • 70
Sriram
  • 838
  • 7
  • 15

2 Answers2

1

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
  • 838
  • 7
  • 15
0

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
  • 6,112
  • 6
  • 45
  • 70