List Info

Thread: Template add filter




Template add filter
user name
2007-12-30 07:43:59
Hi, i am writing this because i wanted to decrement a
variable.
To increment, i used var|add:1
To decrement i tryed var|add:-1, but it gives this error:
TemplateSyntaxError at (...)
add requires 1 arguments, 0 provided

why not create a sub filter?
like var|sub:1

i thing that i am not the only one that needs to decrement a
variable
in templates.

thx for the time

Bruno Almeida


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Template add filter
user name
2007-12-30 08:29:51
On Dec 30, 2007 8:43 AM, kool < brunoalreisgmail.com">brunoalreisgmail.com> wrote:
Hi, i am writing this because i wanted to decrement a variable.
To increment, i used var|add:1
To decrement i tryed var|add:-1, but it gives this error:
TemplateSyntaxError at (...)
add requires 1 arguments, 0 provided

Put the -1 in quotes: var|add:&quot;-1";, and it will do what you want.

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users"; group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to django-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )