Задать вопрос

Тел: +7 965 3737 888

447

Просмотров

1

Ответов

If in list template tag

<p>Given an item and a list, check if the item is in the list</p>
-----
item = 'a'
list = [1, 'b', 'a', 4]
-----
{% ifinlist item list %}
    Yup, it's in the list
{% else %}
    Nope, it's not in the list
{% endifinlist %}

Вопрос полезен? Да0/Нет0
file_2537.py(1.7Кб)
None

Ответы (1):

Ответaaloy:24.09.2007
Ответ полезен? Да0/Нет0

If the first term is not a variable, it gives an error, so it does not allow : {% ifinlist "constant" list %} ... {% endifinlist %} If we patch the code making val1 = self.var1 would work properly