{% macro render_generic_field(field) %}
  <div class="form-group">
    <div class="col-md-offset-1 col-md-10">
      {{ field(class="form-control", placeholder=field.label.text, **kwargs) }}

      {% for error in field.errors %}
        <div class="alert alert-danger alert-dismissible" role="alert">
          <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          {{ error }}
        </div>
      {% endfor %}
    </div>
  </div>
{% endmacro %}

{% macro show_flashed_messages() %}
  {% with messages = get_flashed_messages(with_categories=true) %}
    {% if messages %}
      {% for category, message in messages %}
        {{ show_message(message, category) }}
      {% endfor %}
    {% endif %}
  {% endwith %}
{% endmacro %}

{% macro show_message(message, category="info") %}
  <div class="alert alert-{{ category }} alert-dismissible" role="alert">
    <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    {{ message }}
  </div>
{% endmacro %}

{% macro render_generic_field(field, with_label=False) %}
  <div class="form-group">
    <div class="col-md-offset-1 col-md-10">
      {% if with_label %}
        {{ field.label(class="control-label") }}
        {{ field(class="form-control", **kwargs) }}
      {% else %}
        {{ field(class="form-control", placeholder=field.label.text, **kwargs) }}
      {% endif %}

      {% for error in field.errors %}
        <div class="alert alert-danger alert-dismissible" role="alert">
          <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          {{ error }}
        </div>
      {% endfor %}
    </div>
  </div>
{% endmacro %}

{% macro show_flashed_messages() %}
  {% with messages = get_flashed_messages(with_categories=true) %}
    {% if messages %}
      {% for category, message in messages %}
        {{ show_message(message, category) }}
      {% endfor %}
    {% endif %}
  {% endwith %}
{% endmacro %}

{% macro show_message(message, category="info") %}
  <div class="alert alert-{{ category }} alert-dismissible" role="alert">
    <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    {{ message }}
  </div>
{% endmacro %}

Add with_label argument to render_generic_field macro
Add with_label argument to render_generic_field macro
