How to add Conditional CSS class based on Python If statement

jinja2, python, webapp2

Solution

Write if condition this way.

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

Problem

How do you add a conditional CSS class based on a Python if statement in the following example to show the `has-success has-feedback` form element? ``` <div class="form-group {% if not error_username %} has-success has-feedback {% endif %}"> ```

Original source