I want to enable below button based on the boolean value from context i.e. {{ enable }}. if enable is True then make it enable otherwise disabled.
<input type="submit" name="upload" class="btn btn-primary" value="Upload" disabled/>
The simplest way to do that is:
<input type="submit" name="upload" class="btn btn-primary"
value="Upload" {% if not enable %}disabled{%endif%} />
do this:
{% if enable %}
<input type="submit" name="upload" class="btn btn-primary" value="Upload" />
{% else %}
<input type="submit" name="upload" class="btn btn-primary" value="Upload" disabled/>
{% endif %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With