From 30114f34e87eeeb37ecac3176e6fff62519ebb6e Mon Sep 17 00:00:00 2001 From: RaNaN Date: Mon, 23 Aug 2010 14:41:38 +0200 Subject: better django compatbility --- module/web/pyload/templatetags/token.py | 13 +++++++++++++ module/web/templates/default/login.html | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 module/web/pyload/templatetags/token.py (limited to 'module') diff --git a/module/web/pyload/templatetags/token.py b/module/web/pyload/templatetags/token.py new file mode 100644 index 000000000..fc190db73 --- /dev/null +++ b/module/web/pyload/templatetags/token.py @@ -0,0 +1,13 @@ + +from django import VERSION +from django import template +register = template.Library() + +if VERSION[:3] < (1,1,2): + + @register.tag() + def csrf_token(): + """ + Return nothing, since csrf is deactivated in django 1.1 + """ + return "" diff --git a/module/web/templates/default/login.html b/module/web/templates/default/login.html index f4b0a5560..7ae78183b 100644 --- a/module/web/templates/default/login.html +++ b/module/web/templates/default/login.html @@ -1,5 +1,6 @@ {% extends 'default/base.html' %} {% load i18n %} +{% load token %} {% block title %}{% trans "Login" %} - {{block.super}} {% endblock %} @@ -7,6 +8,7 @@
+ {% csrf_token %}
-- cgit v1.2.3