i have written this code with flask:
<select name="status">
{% set a=stati %}
<option value="{{i[3]}}">{{i[3]}}</option>
{% a.remove(i[3]) %}
{% for c in a %}
<option value="{{c}}">{{c}}</option>
{% endfor %}
</select>
I get this error message, how i can fix it?
{% a.remove(i[3]) %} jinja2.exceptions.TemplateSyntaxError: Encountered unknown tag 'a'. Jinja was looking for the following tags: 'elif' or 'else' or 'endif'. The innermost block that needs to be closed is 'if'.
I Try with
{{ a.remove(i[3]) }}
And with {% set a.remove(i[3]) %}
CodePudding user response:
Okay, i have fix it, with chatGPT by OpenAI:
{% set a=stati[:] %}
<option value="{{i[3]}}">{{i[3]}}</option>
{% set b = a.remove(i[3]) %}
{% for c in a %}
<option value="{{c}}">{{c}}</option>
{% endfor %}
CodePudding user response:
You should not apply CRUD operations inside the template. That's why you use Flask...