On May 2, 4:14 pm, А. Р. <4d876...@gmail.com> wrote:
> > @csrf_exempt
> > Any ideas what I'm doing wrong?
>
> Try importing csrf_exempt at the top of your views.py:
> from django.views.decorators.csrf import csrf_exempt
Yes, I already did that - just omitted the declaration from the
message to save space. Oops.

On May 2, 5:14 pm, Ian Clelland <clell...@gmail.com> wrote:
> On Mon, May 2, 2011 at 7:45 AM, Robert Cross <blueb...@gmail.com> wrote:

> The fact that, on GET, you are getting a 301 first means that the URL that
> you are providing is not the correct one for the resource. You probably have
> "/posttest/" defined in your urls.py, but you are using wget to access
> "/posttest" (no trailing slash). On a GET request, it is perfectly safe to
> just issue a redirect to the correct URL, but it is not necessarily safe for
> POST requests. I believe that Django will issue the redirect anyway, buy the
> user agent is *not* supposed to just blindly post the data to the new URL
> without some sort of user interaction.
>
> To eliminate this as a possible error source, try putting the trailing "/"
> on the URL in the command line:
>
> $ wget --post-data 
> 'data=Something'http://localhost:8000/posttest/?data=CommandLine
>
> Then you should get { 'data': 'CommandLine' } in request.GET, and { 'data':
> 'Something' } in request.POST.
Darn it - you were exactly right. Added the trailing slash, and the
code (the test one I gave and the real code) is now working
flawlessly. Thanks for the pointer and the explanation. :)

Bob

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

Reply via email to