> thank you very much for your suggestion to use the RefrenceProperty. I
> am halfway there now. The Product form now displays a dropdown.
> However, I am not really clear on how to specify what will be
> displayed in that dropdown. Here is what it is displaying currently
> when you open a dropdown which lets you select a SizeOption model.
>
You can use a custom ModelChoiceField and override its
label_from_instance() method:
class SizeOptionChoiceField(ModelChoiceField):
def label_from_instance(self, obj):
return obj.code
class ProductForm(djangoforms.ModelForm):
class Meta:
model = Product
size_option = djangoforms.SizeOptionChoiceField(SizeOption, None)
Alternatively, you can override the __unicode__ method of your model:
class SizeOption(db.Model):
code = db.StringProperty(required = True)
html = db.StringProperty(required = True, multiline = True)
def __unicode__(self):
return self.code
Cheers,
Alex
--
www.muspy.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---