Hi,

I have a couple of model classes which are in one-to-many
relationship. For example, one of the classes is a Product, and
another one is Colours.

I know that I can list the acceptable field values in this manner:

size_code = db.StringProperty(required = True, choices = ['colour1',
'colour2', 'colour3'])

It would be much better if I could generate the list of choices
dynamically, depending on what models of the class Colours exist, i.e.
the list of available colours can change over time and I would like to
avoid having to modify the program code every time there is a change.

Why am I doing this? It is because I want to use it with the
db.djangoforms.ModelForm class. If I have a list of choices for a
field, the ModelForm automatically gives me a dropdown. If there is no
list of choices all I get is a plain text entry field.

Does anyone know how to address this problem? I tried using GQL
queries, but without any success. Python was throwing errors every
time I tried to do that.

Best regards,
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 google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to