6

I am using Django and I am wondering how I can accomplish this. It works fine in python in Linux but the HTML Templating language keeps saying it cannot parse the array.

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

It says it cannot parse the remainder and then it displays the list.

Cédric Julien
81.2k16 gold badges131 silver badges134 bronze badges
asked Jan 3, 2012 at 14:26

1 Answer 1

13

You can't create arbitrary lists in the Django templating system. You need to pass the created list via your view. See This question for a detailed discussion.

answered Jan 3, 2012 at 14:33
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.