You can get the form data through
self.request.get("name")

and give the object proper property.

for example, in the html

<form action="/submit" method="post">
<input name="a">
<input name="b">
<input type="submit" value="Post">
</form>

in the server side, you write,

class Submit(webapp.RequestHandler):
    def post(self):
        a = self.request.POST.get('a')
        b = self.request.POST.get('b')
        object = Object()
        object.a=a
        object.b=b
        object.put()


On Fri, Jan 23, 2009 at 4:48 PM, David Kamenetz <kamene...@yahoo.ca> wrote:

>
> Has anyone tried to dynamically select which properties they want to
> write to an entity on appengine? For example:
>
> I have a web form with 5 fields, and any given user will fill out some
> subset of those fields. I POST only the fields with data to the server
> (e.g. Fields 1,2,4). On the server side, how do I elegantly write only
> properties 1,2, and 4? The Model class has a function that returns a
> dictionary of property names (Model.properties()), but how would I use
> it to select property names?
>
> In SQL, I would build an INSERT or UPDATE statement by matching the
> fields POSTed against the Model.properties() dictionary. I read trunk/
> google/appengine/ext/db/init.py which seemed to confirm that there is
> no way to refer to the properties as a group. Am I approaching this
> the wrong way? Anyone know of a workaround?
>
>
> >
>


-- 
Stay hungry,Stay foolish.

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