On Thu, 2009-04-23 at 21:23 -0700, Francis wrote: > Hi, I'm using dojo (also tried with jquery) to send json data to my > django application. > > But I can't get it working properly.
The trick to understanding is to think how are you sending the data? In particular, what MIME type is being used? Django's HttpRequest.POST variable is only set up to handle HTML form encoded data -- either application/x-www-form-encoded or multipart/form-data is there are file uploaded involved. I doubt very much that the JSON data is being sent with those encodings. Which means that your assumption to use request.POST isn't valid. Instead, pass the submitted data -- obtained via request.raw_post_data -- to a JSON -> Python converter (such as simplejson.decodestring()) and then pass that dictionary into the form. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---