Of course, if they're integers you could implement the "mul" as a loop
of "add"s... clumsy, but would work.
On 07/19/2017 03:39 PM, Mike Morris wrote:
I am a newbie, but I think the answer is that you can't do that in the
template - instead, calculate the number in the view and pass it to
the template in the context dictionary.
I think it's a design philosophy of Django Template Language to not
support this as it muddies the border between data and presentation.
They've obviously made some exceptions for the really common/easy use
cases - like "|add"
There are other template languages that do support that of course; if
its important enough you could look at changing the template engine...
On 07/18/2017 07:21 PM, sum abiut wrote:
Hi,
needed direction maths filters on django templates. for example how
to you perform this on a template.
a*b +b*c
i did a|mul:b|add:b|mul:c but got a wrong answer. Please
point me to right direction.
cheers,
--
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 [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CAPCf-y648sfPwKJWLmRtcx6tfC_PZP6RP6PjUvCmzRKVfOH%3DSg%40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CAPCf-y648sfPwKJWLmRtcx6tfC_PZP6RP6PjUvCmzRKVfOH%3DSg%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
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 [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/0ff382b8-ecfa-e1ab-43f4-f47bcde5b274%40musicplace.com
<https://groups.google.com/d/msgid/django-users/0ff382b8-ecfa-e1ab-43f4-f47bcde5b274%40musicplace.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/735d3169-5d8f-dfb7-84cf-ba87a490573d%40musicplace.com.
For more options, visit https://groups.google.com/d/optout.