for others looking for an answer, put your value between double quotes: <a href='../{{ position|add:"-1" }}/'>Previous</a> | <a href='../{{ position|add:"1" }}/'>Next</a>
El jueves, 6 de diciembre de 2007 15:44:32 UTC-6, J. Clifford Dyer escribió: > > Hello. > > I'm trying to get a template to render previous and next links on a series > of pages, as follows. > > <a href='../{{ position|add:-1 }}/'>Previous</a> | > <a href='../{{ position|add:1 }}/'>Next</a> > > And I've come across some unexpected behavior. The first line does not > work (add:-1), while the second line does. The first line throws a > TemplateSyntaxError ("add requires 1 arguments, 0 provided"). It works if > I change it to {{ position|add:"-1" }}, but that strikes me as vaguely > crappy, especially since the positive version works as an int. Also > curious if this is the same issue as the one had by ifequal and ifnotequal > in ticket #3670. > > Anybody else seen this issue? > > Cheers, > Cliff > > -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.