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: alasd...@memset.com
web: http://www.memset.com/
Memset Ltd., registration number 4504980.
Building 87, Dunsfold Park, Stovolds Hill, Cranleigh, Surrey, GU6 8TB, UK
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/54F889F2.9040107%40memset.com.
For more options, visit https://groups.google.com/d/optout.