How To Query Gae Datastore To Render A Template (newbie Level)
Solution 1:
There are several issues in your code, starting with the design.
You should have two classes that are getting stored in the datastore (Contract and Person) (If you were using NDB you could have a contract with a structured Property for the Person, but we'll stay simple.)
The Contract could have whatever things you need for a contract and then have a people = ListProperty(db.Key)
After you put() a model instance the db.key() will be populated with the key. That's what you should be passing around to other parts of your code and storing in the ListProperty above.
For example in your redirect after the POST you would have something like self.redirect('/your_contract?person=%s' % a.key()')
To load the stored person you would do: person = db.get(self.request.get('person'))
If you are passing multiple person keys you'll have to double check the webob documentation on how to read multiple values with same key in querystring, but I know it comes back as a list.
Hope this helps
Post a Comment for "How To Query Gae Datastore To Render A Template (newbie Level)"