Hi Carsten, Vijay
On 05/03/15 16:24, Carsten Fuchs wrote:
> Dear Django fellows,
>
> using Django 1.7.5, I have a problem with commas in string literals in
> the cycle tag, e.g. with
>
> {% cycle "Hello, how are you?" "Fine!" %}.
I can reproduce the problem with your sample code.
I think the reason is that the cycle tag supports an older syntax for
backwards compatibility reasons.
{% cycle row1,row2,row3 %}
It looks like this prevents you from using commas in strings when using
the new syntax.
> This happens with or without {% load cycle from future %}
The future version of the cycle tag applies HTML escaping to its
variables. So using it or not using it shouldn't have any affect on your
issue.
A work around would be to assign "Hello, how are you" to a variable.
{% with hello="Hello, how are you?"
{% cycle hello "Fine!" %}.
{% endwith %}
On 05/03/15 16:48, Vijay Khemlani wrote:
> Changing the double quotes for single quotes seems to do the trick,
but I don't know why it works
If you use single quotes and render the template, it outputs 'Hello',
not 'Hello, how are you?' as expected.
Cheers,
Alasdair
[1]
https://docs.djangoproject.com/en/1.7/ref/templates/builtins/#cycle
--
Alasdair Nicol
Developer, MEMSET
mail:
alas...@memset.com
web:
http://www.memset.com/
Memset Ltd., registration number 4504980.
Building 87, Dunsfold Park, Stovolds Hill, Cranleigh, Surrey, GU6 8TB, UK