CSRF error while working through tutorial part 4

2010-04-07 Thread Gang Fu
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   
2   
3   BHCS Poll Details
4   
5   
6   
7   {{ poll.question }}
8   {% if error_message %}{{ error_message }}{%
endif %}
9
10  
11  {% csrf_token %}
12  {% for choice in poll.choice_set.all %}
13  
14  {{ choice.choice }}
15  {% endfor %}
16  
17  
18  
19  

-- 
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.



Re: CSRF error while working through tutorial part 4

2010-04-08 Thread David De La Harpe Golden

On 07/04/10 18:59, Gang Fu wrote:

Following the instruction, my settings.py has



Invalid block tag: 'csrf_token'



You're likely looking at the development version of the tutorial but
using a released version of django. csrf_token is new, and not used with
django 1.1.1.

contrast:

http://docs.djangoproject.com/en/1.1/intro/tutorial04/
http://docs.djangoproject.com/en/dev/intro/tutorial04/

--
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.