Re: request.POST['value'] cannot get value, 500 error

2009-11-11 Thread Sandman
I've been able to extract values from POST and GET objects by doing
request.POST.get('value')

Did you try this?
Sandman.


On Nov 11, 9:07 pm, robinne  wrote:
> Thanks. I tried a lot of different options but nothing was working.
> Finally got it working with this:
>
> req = request.POST['value']#this is how InputEx sends it, with root =
> value.
> parsedRequest = simplejson.loads(req)
> print parsedRequest["Username"]
>
> Basically, I got the array of 'value', then turned that into JSON and
> then read from that.
>
> On Nov 10, 11:06 pm, Tamas Szabo  wrote:
>
> > Does
>
> > request.POST['value'][0]['LastName']
>
> > work?
>
> > It looks like your post data has an array (keyed as 'value') of dicts.
>
> > You might also consider using Firebug (or something similar) to inspect the
> > http requests and responses when you are developing.
>
> > Regards,
>
> > Tamas
>
> > On Wed, Nov 11, 2009 at 2:38 PM, robinne 
> > wrote:
>
> > > I am posting data from a form to a django view. The form is created
> > > using inputEx (a YUI-like interface). The form gets created much like
> > > you create a YUI form and you include names for all your fields in
> > > javascript. It is javascript that creates the form on the page.
>
> > > I am able to load database data from the django view into my form
> > > fields (sending json string to UI), but when I post I cannot access
> > > individual posted values, even though I can see that the
> > > 'request.POST' is getting posted to the django view. The request.POST
> > > looks something like  > > [u'{"FirstName":"Mary","LastName":"Smith"...etc]}>
>
> > > When trying to access a value by using...
>
> > > def MemberInfo(request, member_id):
> > >    if request.method == "POST":
> > >        print request.POST
> > >        try:
> > >            print request.POST['LastName'] #ERROR
>
> > > ...
> > > error message is:
> > >  "POST /MemberInfo/1 HTTP/1.1" 500 54476
>
> > > any ideas?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: request.POST['value'] cannot get value, 500 error

2009-11-11 Thread robinne
Thanks. I tried a lot of different options but nothing was working.
Finally got it working with this:

req = request.POST['value']#this is how InputEx sends it, with root =
value.
parsedRequest = simplejson.loads(req)
print parsedRequest["Username"]

Basically, I got the array of 'value', then turned that into JSON and
then read from that.

On Nov 10, 11:06 pm, Tamas Szabo  wrote:
> Does
>
> request.POST['value'][0]['LastName']
>
> work?
>
> It looks like your post data has an array (keyed as 'value') of dicts.
>
> You might also consider using Firebug (or something similar) to inspect the
> http requests and responses when you are developing.
>
> Regards,
>
> Tamas
>
> On Wed, Nov 11, 2009 at 2:38 PM, robinne wrote:
>
>
>
> > I am posting data from a form to a django view. The form is created
> > using inputEx (a YUI-like interface). The form gets created much like
> > you create a YUI form and you include names for all your fields in
> > javascript. It is javascript that creates the form on the page.
>
> > I am able to load database data from the django view into my form
> > fields (sending json string to UI), but when I post I cannot access
> > individual posted values, even though I can see that the
> > 'request.POST' is getting posted to the django view. The request.POST
> > looks something like  > [u'{"FirstName":"Mary","LastName":"Smith"...etc]}>
>
> > When trying to access a value by using...
>
> > def MemberInfo(request, member_id):
> >    if request.method == "POST":
> >        print request.POST
> >        try:
> >            print request.POST['LastName'] #ERROR
>
> > ...
> > error message is:
> >  "POST /MemberInfo/1 HTTP/1.1" 500 54476
>
> > any ideas?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: request.POST['value'] cannot get value, 500 error

2009-11-10 Thread Tamas Szabo
Does

request.POST['value'][0]['LastName']

work?

It looks like your post data has an array (keyed as 'value') of dicts.

You might also consider using Firebug (or something similar) to inspect the
http requests and responses when you are developing.


Regards,

Tamas



On Wed, Nov 11, 2009 at 2:38 PM, robinne wrote:

>
> I am posting data from a form to a django view. The form is created
> using inputEx (a YUI-like interface). The form gets created much like
> you create a YUI form and you include names for all your fields in
> javascript. It is javascript that creates the form on the page.
>
> I am able to load database data from the django view into my form
> fields (sending json string to UI), but when I post I cannot access
> individual posted values, even though I can see that the
> 'request.POST' is getting posted to the django view. The request.POST
> looks something like  [u'{"FirstName":"Mary","LastName":"Smith"...etc]}>
>
> When trying to access a value by using...
>
> def MemberInfo(request, member_id):
>if request.method == "POST":
>print request.POST
>try:
>print request.POST['LastName'] #ERROR
>
> ...
> error message is:
>  "POST /MemberInfo/1 HTTP/1.1" 500 54476
>
> any ideas?
>
>
> >
>

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



request.POST['value'] cannot get value, 500 error

2009-11-10 Thread robinne

I am posting data from a form to a django view. The form is created
using inputEx (a YUI-like interface). The form gets created much like
you create a YUI form and you include names for all your fields in
javascript. It is javascript that creates the form on the page.

I am able to load database data from the django view into my form
fields (sending json string to UI), but when I post I cannot access
individual posted values, even though I can see that the
'request.POST' is getting posted to the django view. The request.POST
looks something like 

When trying to access a value by using...

def MemberInfo(request, member_id):
if request.method == "POST":
print request.POST
try:
print request.POST['LastName'] #ERROR

...
error message is:
 "POST /MemberInfo/1 HTTP/1.1" 500 54476

any ideas?


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