Hi Consultuning/David,
> You probably want to use a ReferenceProperty to a Colour entity in
> your Product model. Then, customise your form something like this:
>
> class ProductEntryForm(djangoforms.ModelForm):
> class Meta:
> model = Product
>
> colour = djangoforms.ModelChoiceField(Colour, required=True,
> query=Colour.all().order('name'))
>
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.
>---------<
<__main__.SizeOption object at 0x01C77FD0>
<__main__.SizeOption object at 0x01C77E10>
<__main__.SizeOption object at 0x01C77FD0>
I would prefer something more human readable. Here is my model
definition:
class SizeOption(db.Model):
code = db.StringProperty(required = True)
html = db.StringProperty(required = True, multiline = True)
class Product(db.Model):
size_option = db.ReferenceProperty(SizeOption)
class ProductForm(djangoforms.ModelForm):
class Meta:
model = Product
size_option = djangoforms.ModelChoiceField(SizeOption, None)
Thank you,
Martin
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---