无效的块标记:' add_preserved_filters'

时间:2014-07-05 21:10:32

标签: django

在管理员中,我们在使用cycle模板标记时遇到上述错误。

完整堆栈跟踪:

 TemplateSyntaxError at /admin/app/page/
Invalid block tag: 'add_preserved_filters', expected 'elif', 'else' or 'endif'
Request Method: GET
Request URL:    http://localhost:8000/admin/app/page/
Django Version: 1.5.1
Exception Type: TemplateSyntaxError
Exception Value:    
Invalid block tag: 'add_preserved_filters', expected 'elif', 'else' or 'endif'
Exception Location: /home/alex/.pyenv/versions/2.7.5/lib/python2.7/site-packages/Django-1.5.1-py2.7.egg/django/template/base.py in invalid_block_tag, line 327
Python Executable:  /home/alex/.pyenv/versions/2.7.5/bin/python
Python Version: 2.7.5
Python Path:    
['/home/alex/.pyenv/versions/2.7.5/lib/python2.7/site-packages/setuptools-5.4-py2.7.egg',
 '/home/alex/.pyenv/versions/2.7.5/lib/python2.7/site-packages/Django-1.5.1-py2.7.egg',
 '/home/alex/.pyenv/versions/2.7.5/lib/python2.7/site-packages/numpy-1.8.1-py2.7-linux-x86_64.egg',
 '/home/alex/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytz-2014.4-py2.7.egg',
 '/home/alex/.pyenv/versions/2.7.5/lib/python27.zip',
 '/home/alex/.pyenv/versions/2.7.5/lib/python2.7',
 '/home/alex/.pyenv/versions/2.7.5/lib/python2.7/plat-linux2',
 '/home/alex/.pyenv/versions/2.7.5/lib/python2.7/lib-tk',
 '/home/alex/.pyenv/versions/2.7.5/lib/python2.7/lib-old',
 '/home/alex/.pyenv/versions/2.7.5/lib/python2.7/lib-dynload',
 '/home/alex/.pyenv/versions/2.7.5/lib/python2.7/site-packages']

1 个答案:

答案 0 :(得分:1)

此模板标记在Django> = 1.6中可用。 根据你的回溯,你正在使用Django-1.5.1。

请将admin_urls.py中的模板标记从1.5与admin_urls.py中的模板标记从1.6进行比较。