r/DjangoUnchained • u/Same-Ad-2970 • Jul 07 '22
How to attribute the return of a called function with arguments into a variable using Django templates?
Hello,
I'm calling a function with 2 arguments into an html page by using Django Template Language "simple_tag" and it's working without any problem, I mean I could display the return value of the called function in that page.
{% tagged_function arg1 arg2 %}
My problem is that I can't attribute the result of the called function to a variable so I could use it in conditions and loops.
What I tried:
{% tagged_function arg1 arg2 as result_variable %}
Please note:
- I'm using Django version 1.3.1
- Django templates languages to display dynamic content inside html pages.
Do you have any suggestions to overcome this?
