You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Polymer 2.0 web components on my Django Project. I needed to make a POST request to my views.py but I'm getting a 403 Error (Forbidden) because my CSRF token was missing or incorrect.
Expected outcome
I should be able to see the body of my request in my views.py
Here's a sample of my views.py for the /delete_credits_submission/ url
"""Note that my request.POST or request.GET should contain this object:
{'pk': 4}
""" def delete_credits_submission(request): print request.GET return HttpResponse('Success!', status=200)
Instead I'm getting this error:
Forbidden (CSRF token missing or incorrect.): /delete_credits_submission/
Usually, when I'm using the Django templates I can easily fix this problem using {% csrf_token %} but that's not the case here.
The text was updated successfully, but these errors were encountered:
Description
I'm using Polymer 2.0 web components on my Django Project. I needed to make a POST request to my views.py but I'm getting a 403 Error (Forbidden) because my CSRF token was missing or incorrect.
Expected outcome
I should be able to see the body of my request in my views.py
Actual outcome
A CSRF error occurs.
Here's a sample code of my custom-element:
`
`
Here's a sample of my views.py for the
/delete_credits_submission/
url"""Note that my request.POST or request.GET should contain this object:
{'pk': 4}
"""
def delete_credits_submission(request): print request.GET return HttpResponse('Success!', status=200)
Instead I'm getting this error:
Forbidden (CSRF token missing or incorrect.): /delete_credits_submission/
Usually, when I'm using the Django templates I can easily fix this problem using
{% csrf_token %}
but that's not the case here.The text was updated successfully, but these errors were encountered: