Skip to content

cycle tag in templates cause INTERNAL SERVER ERROR in django 1.6 #546

naimetti opened this Issue Feb 12, 2014 · 5 comments

4 participants


cycle tag in templates cause INTERNAL SERVER ERROR in django 1.6

It could be fixed by simple add {% load cycle from future %} in these templates:



PendingDeprecationWarning at /debug/render_panel/
'The cycle template tag is changing to escape its arguments; the non-autoescaping version is deprecated. Load it from the future tag library to start using the new behavior.

File "/usr/lib64/python3.3/site-packages/django/core/handlers/" in get_response

  1. response = wrapped_callback(request, callback_args, *callback_kwargs) File "/usr/lib64/python3.3/site-packages/debug_toolbar/" in render_panel
  2. content = panel.content File "/usr/lib64/python3.3/site-packages/debug_toolbar/panels/" in content
  3. return render_to_string(self.template, self.get_stats()) File "/usr/lib64/python3.3/site-packages/django/template/" in render_to_string
  4. t = get_template(template_name) File "/usr/lib64/python3.3/site-packages/django/template/" in get_template
  5. template, origin = find_template(template_name) File "/usr/lib64/python3.3/site-packages/django/template/" in find_template
  6. source, display_name = loader(name, dirs) File "/usr/lib64/python3.3/site-packages/django/template/" in call
  7. return self.load_template(template_name, template_dirs) File "/usr/lib64/python3.3/site-packages/django/template/" in load_template
  8. template = get_template_from_string(source, origin, template_name) File "/usr/lib64/python3.3/site-packages/django/template/" in get_template_from_string
  9. return Template(source, origin, name) File "/usr/lib64/python3.3/site-packages/debug_toolbar/panels/templates/" in new_template_init
  10. old_template_init(self, template_string, origin, name) File "/usr/lib64/python3.3/site-packages/django/template/" in init
  11. self.nodelist = compile_string(template_string, origin) File "/usr/lib64/python3.3/site-packages/django/template/" in compile_string
  12. return parser.parse() File "/usr/lib64/python3.3/site-packages/django/template/" in parse
  13. compiled_result = compile_func(self, token) File "/usr/lib64/python3.3/site-packages/django/template/" in do_for
  14. nodelist_loop = parser.parse(('empty', 'endfor',)) File "/usr/lib64/python3.3/site-packages/django/template/" in parse
  15. compiled_result = compile_func(self, token) File "/usr/lib64/python3.3/site-packages/django/template/" in cycle
  16. PendingDeprecationWarning, stacklevel=2)

Unless you're running under -Werror, this should just be a warning, not an error.

{% load cycle from future %} would break Django 1.4 and 1.5, while the Debug Toolbar aims at supporting all current versions of Django. Simply adding it isn't an acceptable solution.

@aaugustin aaugustin added the Bug label Feb 13, 2014

Would it be reasonable to check the version of Django and load from future if it's >= 1.6?


That wouldn't suffice, we'd also need a different syntax wherever the tag is used in templates.

The only solution I can think of at this time is copying the definition of the new cycle tag in the toolbar.


Closing as the reporter never answered my question about -Werror.

@aaugustin aaugustin closed this Apr 3, 2014
blopker commented Aug 16, 2014

If anyone coming here has this problem and can't disable -Werror (for what ever reason) put this in your

import warnings
warnings.filterwarnings('ignore', category=PendingDeprecationWarning)

This disables all PendingDeprecationWarning warnings, so be careful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.