> Excerpts from taso's message of Fri Jan 28 17:05:21 -0200 2011:
> > A user action triggers a POST that looks like:
>
> > action "update"
> > data { "field1": 8,"id": 2 }
> > (copied from firebug)
>
> So, it's a POST with an "action" fiend and a "data" field that looks like
> a JSON value, right?
Absolutley right. I have the option of encoding the data on the
frontend to be passed as a JSON value. Currently that is off; that is,
the flag to encode as JSON is false so the data is supposed to be
passed as a "regular" POST parameter set, even if it looks like JSON.
> Did you tried un-encoding the JSON, like this:
>
> from django.utils.simplejson import simplejson
>
> data = simplejson.loads(request.POST['data'])
> id = data['id']
>
> Regards,
> Matías
> --
> Matías Aguirre <matiasagui...@gmail.com>
Absolutely works. My earlier attempt at parsing JSON was bad (new to
django + JSON). Thanks much Matías!
Best,
Taso
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment