Also I guess mathfilters just executes left-to-right

so

a|mul:b|add:b|mul:c

is (((a * b) + b) * c)

On Wed, Jul 19, 2017 at 1:50 AM, James Schneider <jrschneide...@gmail.com>
wrote:

>
>
> On Jul 18, 2017 7:21 PM, "sum abiut" <suab...@gmail.com> 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.
>
>
> I wouldn't do any sort of advanced math in the template. It should be
> completed in the view and added to the template context, then referenced as
> a template variable. The template processor has no concept of the order of
> operations in math.
>
> -James
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CA%2Be%2BciWfni0w6XZmfqrjnsrTLiWZLh0N
> Wu9ye%2BA_Cm0NDb6x3A%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWfni0w6XZmfqrjnsrTLiWZLh0NWu9ye%2BA_Cm0NDb6x3A%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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/CALn3ei3eX0FOfV2aNMZJbNawsW1ywVRn%2BLKb86V_23uXW9cisQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to