Re: Can I perform calculations directly in django tags/filters?

2019-12-18 Thread Luqman Shofuleji
Try using django-mathfilters. https://pypi.org/project/django-mathfilters/ On Wed, Dec 18, 2019, 11:55 PM Adeotun Adegbaju wrote: > you should indicate which files codes should be added to > > On Tuesday, November 18, 2008 at 11:21:09 PM UTC+1, Daniel Roseman wrote: >> >> On Nov 18, 7:55 pm, ja

Re: Can I perform calculations directly in django tags/filters?

2019-12-18 Thread Adeotun Adegbaju
you should indicate which files codes should be added to On Tuesday, November 18, 2008 at 11:21:09 PM UTC+1, Daniel Roseman wrote: > > On Nov 18, 7:55 pm, jago wrote: > > I am thinking about something like {{ (width - 5) *12 }} ? > > No. You can add or subtract using the 'add' filter: > {{

Re: Can I perform calculations directly in django tags/filters?

2008-11-18 Thread Daniel Roseman
On Nov 18, 7:55 pm, jago <[EMAIL PROTECTED]> wrote: > I am thinking about something like {{  (width - 5) *12  }}  ? No. You can add or subtract using the 'add' filter: {{ width:add:"-5" }} but anything else will require a custom template tag or filter. Luckily, these are extremely easy to write:

Re: Can I perform calculations directly in django tags/filters?

2008-11-18 Thread DavidA
You can do it in a custom eval-like tag: @register.tag() def evalpy(parser, token): try: tag_name, expression = token.split_contents() except ValueError: raise template.TemplateSyntaxError, "%r tag requires a single argument" % token.contents.split(

Re: Can I perform calculations directly in django tags/filters?

2008-11-18 Thread Rajesh Dhawan
> I am thinking about something like {{  (width - 5) *12  }}  ? No. That syntax is not supported in Django templates. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Can I perform calculations directly in django tags/filters?

2008-11-18 Thread jago
I am thinking about something like {{ (width - 5) *12 }} ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe fro