I'm still pretty new to Django and have been following some online
tutorials to learn it.
I've run into a problem where the CSRF_FAILURE_VIEW doesn't seem to get
used correctly and I'm not sure why.
Here is the relevant code:
*myProject/custom/csrf/views.py*
from django.shortcuts import render_to_response
def csrf_failure(request, reason=""):
ctx = {'reason':reason}
return render_to_response("csrf/failure.html", ctx)
*myProject/settings.py*
TEMPLATE_DIRS = (
os.path.join(os.path.dirname(__file__), 'templates'),
)
CSRF_FAILURE_VIEW = 'myProject.custom.csrf.views.csrf_failure'
*myProject/templates/csrf/failure.html*
{% extends 'homepage/index.html' %}
{% block content %}
<h1>Invalid Request</h1>
{% endblock %}
>From what I can tell my version of *csrf_failure* never gets called.
>From what I've read
>here<https://docs.djangoproject.com/en/dev/ref/settings/#csrf-failure-view>
>I've
done this correctly.
There are no errors, but my custom view never gets used.
Any suggestions?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/AkIOxJyDisoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.