diff options
author | Martin Green <martin.speleo@gmail.com> | 2011-05-02 03:11:17 +0100 |
---|---|---|
committer | Martin Green <martin.speleo@gmail.com> | 2011-05-02 03:11:17 +0100 |
commit | 289b882a158d21bf9ab4ec7b673b4c5d47c4c078 (patch) | |
tree | 3d44ac0fbe775e07913680b94559c0e973c41b84 | |
parent | 925ed4635be4de20dd95361485c91905a593d2e3 (diff) | |
download | troggle-289b882a158d21bf9ab4ec7b673b4c5d47c4c078.tar.gz troggle-289b882a158d21bf9ab4ec7b673b4c5d47c4c078.tar.bz2 troggle-289b882a158d21bf9ab4ec7b673b4c5d47c4c078.zip |
Attempt to get csrf tag working in django 1.1-
-rw-r--r-- | core/models.py | 4 | ||||
-rw-r--r-- | templates/csrffaker.py | 9 | ||||
-rw-r--r-- | templates/newlogbookentry.html | 1 |
3 files changed, 13 insertions, 1 deletions
diff --git a/core/models.py b/core/models.py index 73063b2..87f8ea9 100644 --- a/core/models.py +++ b/core/models.py @@ -451,10 +451,12 @@ class Cave(TroggleModel): return res
def getCaveByReference(reference):
- print reference
areaname, code = reference.split("-", 1)
+ print areaname, code
area = Area.objects.get(short_name = areaname)
+ print area
foundCaves = list(Cave.objects.filter(area = area, kataster_number = code).all()) + list(Cave.objects.filter(area = area, unofficial_number = code).all())
+ print list(foundCaves)
assert len(foundCaves) == 1
return foundCaves[0]
diff --git a/templates/csrffaker.py b/templates/csrffaker.py new file mode 100644 index 0000000..86b1318 --- /dev/null +++ b/templates/csrffaker.py @@ -0,0 +1,9 @@ +import django +if django.VERSION[0] >=1 and django.VERSION[1] > 1: + pass +else: + from django import template + + register = template.Library() + @register.tag + def csrf_token(parser, token): return "" diff --git a/templates/newlogbookentry.html b/templates/newlogbookentry.html index 099ae2b..4e8eda6 100644 --- a/templates/newlogbookentry.html +++ b/templates/newlogbookentry.html @@ -1,4 +1,5 @@ {% extends "base.html" %}
+{% load csrffaker %}
{% block title %}Logbook {{logbookentry.id}}{% endblock %}
{% block head %}
<script>
|