Receiving information

0 views
Skip to first unread message

Dhruv Adhia

unread,
Jul 3, 2009, 12:44:26 PM7/3/09
to Django users
Hello All,

I am trying to send information from iPhone to django app through
json.

I got "Message" json block spitting in the form as below:

message json format

{
"Messages": [
{
"id":1.2.3.....n,
"Message": "some message"
}
................
............
]
}

Now on the django side on apache server all I see is this,

{
"Messages": [ ]
}

In short I am not receiving the message, Here is the function that I
wrote in views.py
# I only want to receive the message therefore I am ignoring id
information
def message_json(request):
message_list=[]
try:
message_list = request.POST['Message']
except:
pass
data_out = simplejson.dumps({"Messages":
message_list},sort_keys=False, indent=4)
return HttpResponse('\n'.join([l.rstrip() for l in
data_out.splitlines()]),mimetype ="text/javascript")

Any thoughts?

Thank you,
Dhruv

chefsmart

unread,
Jul 4, 2009, 12:01:24 PM7/4/09
to Django users
Did you try HttpRequest.raw_post_data

Regards,
CM.

Dhruv Adhia

unread,
Jul 4, 2009, 3:00:59 PM7/4/09
to django...@googlegroups.com
Nope I have not used it, Can you give me an example of it?

Thanks,
--
Dhruv Adhia
http://thirdimension.com

Reply all
Reply to author
Forward
0 new messages