I've been trying to figure this out for hours across a couple of days,
and can not get it to work. I've been everywhere. I'll continue trying
to figure it out, but was hoping for a quicker solution. I'm using App
Engine datastore + Django.

Using a query in a view and custom forms, I was able to get a list to
the form but then I was not able to post. I have been trying to figure
out how to dynamically add the choices as part of the Django form...
I've tried various ways with no success. Help!

Below are the two models and my form. In InfoForm, I’d like to display
a list of address_id from the Locations db for the current user. By
the way, I realize I need to use some other sort of property for
address_id, and have tried several recommendations, but have not been
able to figure out the right approach yet.

class Info(db.Model):
    user = db.UserProperty()
    address_id = db.StringProperty()
    info = db.StringProperty()
    created = db.DateTimeProperty(auto_now_add=True)
    modified = db.DateTimeProperty(auto_now=True)

class Locations(db.Model):
    user = db.UserProperty()
    address_id = db.StringProperty()
    address = db.StringProperty()

class InfoForm(djangoforms.ModelForm):
    address_id = forms.ChoiceField()
    info = forms.ChoiceField(choices=INFO_CHOICES)      class Meta:
            model = Info
            exclude = ['user','created','modified']

Example of data in Locations:
user = t...@example.com
address_id = home
address = 999 washington st, somecity, CA

user = t...@example.com
address_id = work
address = 123 lincoln st, somecity, CA

So, if t...@example.com is logged in, I’d like to display home and
work in the address_id (pull-down menu) field of InfoForm.

Thanks

--~--~---------~--~----~------------~-------~--~----~
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