Datastore query outputting for Django form instance
- by Jelle
Hello!
I'm using google appengine and Django. I'm using de djangoforms module and wanted to specify the form instance with the information that comes from the query below.
userquery = db.GqlQuery("SELECT * FROM User WHERE googleaccount = :1", users.get_current_user())
form = forms.AccountForm(data=request.POST or None,instance=?????)
I've found a snippet in a sample app that does this trick, but I can't modify it to work with the query I need.
gift = User.get(db.Key.from_path(User.kind(), int(gift_id)))
if gift is None:
return http.HttpResponseNotFound('No gift exists with that key (%r)' %
gift_id)
form = RegisterForm(data=request.POST or None, instance=gift)
Could anyone help me?