0
I have a select:
<select class="form-control">
<option value="0" selected>Selecione uma opção</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
</select>
And just below, mixed, I have the following code on Python
:
{% for objeto in objetos %}
{% if objeto.escolha == 'opcao do select' %}
FAÇA ISSO
{% else %}
FAÇA AQUILO
{% endif %}
{% endfor %}
How do I save the selected value in select
to be used in if
of the code Python
?
I believe that you wanted to take the value of select and make a change to the page, but python renders the page and sends it to the client machine, and only by making a new request could it take this value and then do some action, I believe that the best way to solve your problem is by making the change using javascript
– Wictor Chaves