Following the instruction, my settings.py has
...
MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.csrf.middleware.CsrfMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
)
...

but I still get following error:

TemplateSyntaxError at /polls/1/

Invalid block tag: 'csrf_token'

Request Method:         GET
Request URL:    http://localhost:8001/polls/1/
Exception Type:         TemplateSyntaxError
Exception Value:

Invalid block tag: 'csrf_token'

Exception Location:     /usr/lib/pymodules/python2.6/django/template/
__init__.py in invalid_block_tag, line 335
Python Executable:      /usr/bin/python
Python Version:         2.6.4
Python Path:    ['/home/gangfu/main/bhcs', '/usr/lib/python2.6', '/usr/
lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/
python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/
python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/PIL', '/
usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/
python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/usr/lib/
pymodules/python2.6/gtk-2.0', '/usr/local/lib/python2.6/dist-
packages']
Server time:    Wed, 7 Apr 2010 16:41:57 -0400
Template error

In template /home/gangfu/main/bhcs/templates/polls/detail.html, error
at line 11
Invalid block tag: 'csrf_token'
1       <html>
2       <head>
3       <title>BHCS Poll Details</title>
4       </head>
5       <body>
6       <p>
7       <h3>{{ poll.question }}</h3>
8       {% if error_message %}<p><strong>{{ error_message }}</strong></p>{%
endif %}
9
10      <form action="/polls/{{ poll.id }}/vote/" method="post">
11      {% csrf_token %}
12      {% for choice in poll.choice_set.all %}
13      <input type="radio" name="choice" id="choice{{ forloop.counter }}"
value="{{ choice.id }}" />
14      <label for="choice{{ forloop.counter }}">{{ choice.choice }}</
label><br />
15      {% endfor %}
16      <input type="submit" value="Vote" />
17      </form>
18      </body>
19      </html>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to