On Thu, May 28, 2015 at 9:31 AM, Shekar Tippur <[email protected]> wrote:
> Hello,
>
> I am trying to post a request via curl. I get a CSRF verification failed
> message.
>
> Here is the entry in my urls.py
>
> url(r'^setProfile/', AddToUserProfile),
>
>
> class AddToUserProfile(generics.ListAPIView):
>     queryset = UserPrefs.objects.all()
>     serializer_class = UserPrefSerializer
>
>
> class UserPrefSerializer(serializers.ModelSerializer):
>     class Meta:
>         model = UserPrefs
>         fields = ('id', 'prefs', 'obj_id', 'user_id')
>         depth = 1
>
>
> I have read on previous posts that I need to add a
> context_instance=RequestContext(request)
>
>
> How do I add it and what is the right way to handle this?

I have done it like this:

curl -H "Cookie: csrftoken=mycsrfToken" -X POST -d
'csrfmiddlewaretoken= mycsrfToken&...'

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/CACwCsY4RDx-ZrAgd8V8%3DBifHrvn%2BbSg2OM0BWYEJNPrwqn2u5w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to