Friday, May 22, 2015

Re: How to get a application-formpost in django view? Get QueryDict variables.

Here is the request.body:

b"'data[id]', ['83A0C50B5A0A43AD8F60C1066B16A163']&'data[status]', ['paid']&'event',['invoice.status_changed']"

I think, maybe, something is wrong in Django, because these same POST is easy to get using PHP or Rails.. in PHP I get with these:  $_POST['data']['id']

Maybe, something in django isn't implemented yet for these kind POST.

T.·.F.·.A.·.     S+F
Fellipe Henrique P. Soares

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
Twitter: @fh_bash

On Fri, May 22, 2015 at 2:53 AM, Gergely Polonkai <gergely@polonkai.eu> wrote:

I don't think so, maybe the post request is poorly formatted. Can you somehow catch the raw http request for analyzing?

On 22 May 2015 00:14, "Vijay Khemlani" <vkhemlan@gmail.com> wrote:
Maybe the brackets confuse the querydict, try calling its items method (to convert it into a list of tuples) or its dict method (to turn it into a normal python dict)

On Thu, May 21, 2015 at 3:34 PM, Fellipe Henrique <fellipeh@gmail.com> wrote:
Any ideas?

I finish all my possibilities in these problem.. :( and no solution...

T.·.F.·.A.·.     S+F
Fellipe Henrique P. Soares

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
Twitter: @fh_bash

On Thu, May 21, 2015 at 10:23 AM, Fellipe Henrique <fellipeh@gmail.com> wrote:
Thanks, I try that! but show me None as value...

I think, that's because the QueryDict is showed in this way:

<QueryDict: {"'data[id]': ['83A0C50B5A0A43AD8F60C1066B16A163'], 'data[status]': ['paid'], 'event': ['invoice.status_changed']": ['']}>

I think the django takes 

'data[id]': ['83A0C50B5A0A43AD8F60C1066B16A163'], 'data[status]': ['paid'], 'event': ['invoice.status_changed']

as the "key"...

:(

T.·.F.·.A.·.     S+F
Fellipe Henrique P. Soares

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
Twitter: @fh_bash

On Thu, May 21, 2015 at 10:15 AM, Gergely Polonkai <gergely@polonkai.eu> wrote:

Assuming your QueryDict is called my_post_data, use my_post_data.get('data[id]').

On 21 May 2015 15:28, "Fellipe Henrique" <fellipeh@gmail.com> wrote:
Hello, 

I need to get one application-form-post content from one server. This server isn't mine.

They send to me this application-form-post, and in Django View I receive this:

<QueryDict: {'data[id]': ['D6adasd7065C2C0A84C96B47EA17705991B14'], 'data[status]': ['paid'], 'event': ['invoice']}>

I need to get: data['id'], data['status']  and event variables..

How I do this in django? Because I can't work with QueryDict... I try to transform in python dict, in python list, but anyone works...

Any idea for these problem?

Regards,


T.·.F.·.A.·.     S+F
Fellipe Henrique P. Soares

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
Twitter: @fh_bash

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF1jwZFv5zwKHaDAFOz06n_%2B4EiNzzFoYx9t_MfTNnEFranAWg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACczBULAgWb%3D6sn1JHxeg_nq%2BO%3DwR9bTBNR69QsUSKog1FB%3DKw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF1jwZHE9K2n%3Dvu-yb2HuNSvkJcx3XYqo6KTzmRYKPESVtGOEw%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALn3ei2%2BKgFYd8cVmYJULNfWq%2B7Wh7i_9F10jFrvYdB%3D_XuLMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACczBU%2B33yO-yoawMbT9VPFpcD6_81QZWEAwGVSc-TnqKthtYQ%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF1jwZGxjJsQv%2BAt8aVVMsCH6TUvAmU8oTbSGLk8yvvWcKB0%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment