Can you declare multiple variables in a django template?

I know this is not good practice, but is there a way to declare multiple variables in a statement with in a django template.

For example, I want to do something like this:

{% with a="a", b="b", c="c" %}
    {{a}}
    {{b}}
    {{c}}
{% endwith %}

Edit My actual use case:

{% with a,b,c=object|get_abc %}
     {{a}}
     {{b}}
     {{c}}
{% endwith %} 

Edit 2 A new question for the first Change: Assign several variables in an instruction with after returning multiple values ​​from templatetag

+4
source share
1 answer

The example on the document page clearly states that you can assign several variables, but you do not need these commas:

{% with alpha=1 beta=2 %}
    ...
{% endwith %}

Link:

with template tag

+8
source

Source: https://habr.com/ru/post/1676944/


All Articles