Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django - Invalid block tag: 'csrf_tokan', expected 'endblock' [closed]

Tags:

django

I cannot understand why my django app does not understand template tags. I get this error:

Invalid block tag: 'csrf_tokan', expected 'endblock'

urls.py:

urlpatterns = patterns('',
    url(r'^index/', 'myproj.views.index'),
    url(r'^admin/', include(admin.site.urls)),
)

views.py:

@staff_member_required
def index(request):
    return render(request, 'index.html', locals())

index.html:

{% extends "admin/base.html" %}
{% block content %}
     {% csrf_tokan %}
{% endblock %}

Any ideas?

like image 905
max Avatar asked Oct 23 '25 16:10

max


1 Answers

You need to do:

{% extends "admin/base.html" %}

{% block content %}
     {% csrf_token %}
{% endblock %}
like image 167
Brandon Avatar answered Oct 25 '25 16:10

Brandon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!