Opened 7 years ago

Closed 7 years ago

Last modified 7 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 7 years ago by Russell Keith-Magee

Triage Stage: UnreviewedAccepted

comment:2 Changed 7 years ago by Russell Keith-Magee

Component: UncategorizedTemplate system

comment:3 Changed 7 years ago by Chris Beaven

Resolution: invalid
Status: newclosed

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

comment:4 Changed 7 years ago by Chris Beaven

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