Thursday, May 28, 2015

django handling requests - getting CSRF verification failed. Request aborted.

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?

- Shekar

--
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/ed9461e1-7e8e-4794-af37-6cb63120b775%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment