7
7
7a-6662020-05-29 13:21:14
Django
7a-666, 2020-05-29 13:21:14

Are there analogues of the __in method in templates?

Let's say I have an array of values ​​​​and there is a variable with some value
And I need to write a condition in the template, if the array has a match with the variable, then the condition returns True, I can loop through all this and check it, but it's somehow not beautiful
In the models for this there is a __in method
In templates, something close is the length filter, but I need to check the value itself and not the number of characters

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2020-05-29
@7a-666

read the doc for you https://docs.djangoproject.com/en/3.0/ref/template...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question