Flask wtforms DecimalField not displaying in HTML
<p>My TextField forms are displaying fine in the html page, but not the DecimalFields. The DecimalFields don't display at all.</p>

<p>My forms.py:</p>

<pre><code>from flask.ext.wtf import Form
from wtforms import TextField, validators, IntegerField, DateField, BooleanField, DecimalField

class EnterPart(Form):
    Description = TextField(label='label', description="description", validators=[validators.required()])
    VendorCost = DecimalField(label='label',description="cost")
</code></pre>

<p>My application.py:</p>

<pre><code>from flask import Flask, render_template, request, redirect, url_for
def index():
    form = EnterPart(request.form) 
    return render_template('index.html', form=form)
</code></pre>

<p>My index.html:</p>

<pre><code>{% extends "base.html" %} {% import 'macros.html' as macros %} 
{% block content %}
{{ form.hidden_tag() }} 
{{ macros.render_field(form.Description, placeholder='Description', type='dbSerial', label_visible=false) }}
    {{ macros.render_field(form.VendorCost, placeholder='Category', type='dbSerial', label_visible=false) }}
    {% endblock %} 
</code></pre>

<p>I've been building from the tutorial here:
<a href="http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world" rel="nofollow">http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world</a></p>

<p>Thanks in advance.</p>

<p>Macros.html didn't have an option for dealing with DecimalField. By adding a rendering option for DecimalField, it now displays correctly.</p>

<p>I changed a block in macros.html from:</p>

<pre><code>&lt;div class="form-group {% if field.errors %}has-error{% endif %} {{ kwargs.pop('class_', '') }}"&gt;
    {% if (field.type != 'HiddenField' or field.type !='CSRFTokenField') and label_visible %}
        &lt;label for="{{ field.id }}" class="control-label"&gt;{{ field.label }}&lt;/label&gt;
    {% endif %}
    {% if field.type == 'TextField' %}
        {{ field(class_='form-control', **kwargs) }}
    {% endif %}
    {% if field.errors %}
        {% for e in field.errors %}
            &lt;p class="help-block"&gt;{{ e }}&lt;/p&gt;
        {% endfor %}
    {% endif %}
&lt;/div&gt;
</code></pre>

<p>to:</p>

<pre><code>&lt;div class="form-group {% if field.errors %}has-error{% endif %} {{ kwargs.pop('class_', '') }}"&gt;
    {% if (field.type != 'HiddenField' or field.type !='CSRFTokenField') and label_visible %}
        &lt;label for="{{ field.id }}" class="control-label"&gt;{{ field.label }}&lt;/label&gt;
    {% endif %}
    {% if field.type == 'TextField' %}
        {{ field(class_='form-control', **kwargs) }}
    {% endif %}
    {% if field.type == 'DecimalField' %}
        {{ field(class_='form-control', **kwargs) }}
    {% endif %}
    {% if field.errors %}
        {% for e in field.errors %}
            &lt;p class="help-block"&gt;{{ e }}&lt;/p&gt;
        {% endfor %}
    {% endif %}
&lt;/div&gt;
</code></pre>

python flask wtforms flask-wtforms