mbr / flask-bootstrap

Ready-to-use Twitter-bootstrap for use in Flask.
http://pypi.python.org/pypi/Flask-Bootstrap
Other
1.58k stars 724 forks source link

`description` property isn't rendered for `BooleanField` #197

Open shnela opened 5 years ago

shnela commented 5 years ago

I have following form definition:

class Form(FlaskForm):
    text = StringField(description='Some visible text')
    unique = BooleanField(description="Won't be rendered")

And below I'm presenting how does html rendered by following template loooks like:

{% for field in form %}
    {{ wtf.form_field(field) }}
{% endfor %}
<div class="form-group "><label class="form-control-label" for="text">Text</label>
        <input class="form-control" id="text" name="text" type="text" value="">
        <small class="form-text text-muted">Some visible text</small>
</div>
<div class="form-check">
      <label class="form-check-label">
      <input class="form-check-input" id="unique" name="unique" type="checkbox" value="y">
Unique
     </label>
</div>

Here's how it looks like live: image

Why isn't description for BooleanField rendered?

I'm using Flask-Bootstrap4

shnela commented 4 years ago

It looks like checkbox field is rendered separately here, but descriptor field is rendered for other field types only here.

Would be someone interested in merging pull request if I've fixed that?

shnela commented 4 years ago

And workaround if someone needed:

class Form(FlaskForm):
    text = StringField(description='Some visible text')
    unique = BooleanField(label='Unique - <small>Bow this "description" is visible</small>')