How to add a conditional CSS class based on Python If statement

How can I add a conditional CSS class based on the Python if statement in the following example to show a form element has-success has-feedback

?

<div class="form-group {% if not error_username %} has-success has-feedback {% endif %}">

      

+3
python jinja2 webapp2


source to share


1 answer


Write if this is a condition.



<div class="form-group {{'has-success has-feedback' if not error_username }}">

      

+6


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics