Python value in list

I am using Django and I am wondering how can I do this. It works fine in python on Linux, but the HTML Templating language continues to say that it cannot parse an array.

{% if myvalue in ["128","256","512","768","1024","1536","2048","3072","5120","10240"] %} <p> Hello World {% endif %} 

It says that he cannot parse the remainder and then displays a list.

+6
source share
1 answer

You cannot create arbitrary lists in the Django template system. You need to pass the list through your view. See This Question for a detailed discussion.

+13
source

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


All Articles