Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#13402 closed (invalid)

'cycle' template tag can't handle mix of single, double quotes

Reported by: anonymous Owned by: nobody
Component: Template system Version: 1.2-beta
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


In a template, this:

	{% cycle '<div class="row">', '', '' %}

produces this:

TemplateSyntaxError at /path/to-url/
Could not parse the remainder: '<div class='row'>""' from '""<div class='row'>""'

So does the reverse (encapsulating single quotes within double quotes). Triple-quoted strings also do not work.

Change History (4)

comment:1 Changed 6 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 6 years ago by russellm

  • Component changed from Uncategorized to Template system

comment:3 Changed 6 years ago by SmileyChris

  • Resolution set to invalid
  • Status changed from new to closed

You're incorrectly using the old format - don't use commas (see

comment:4 Changed 6 years ago by SmileyChris

Oh, and some proof:

In [1]: from django.template import *

In [2]: t = Template('''{% cycle '<a href="test">' '<a href="test2">' %}''')

In [3]: t.render(Context())
Out[3]: u'<a href="test">'
Note: See TracTickets for help on using tickets.
Back to Top