Skip to main content

wtforms-widgets

Decorator driven wtforms extension with Bootstrap 5 support for Flask

Copyright (c) The Pycroft Authors. See the AUTHORS file.

Install with

pip install wtforms-widgets

Initialize your form with wtforms_widgets.base_form.BaseForm instead of flask_wtf.FlaskForm or wtforms.Form.

Import the StringField and PasswordField from wtforms_widgets.fields.core.

from wtforms import validators

from wtforms.validators import Email
from wtforms_widgets.base_form import BaseForm
from wtforms_widgets.fields.core import StringField, PasswordField

class RegisterForm(BaseForm):
    email = StringField('Email Address', [Email(), validators.DataRequired(message='Forgot your email address?')])
    password = PasswordField('Password', [validators.DataRequired(message='Must provide a password. ;-)')])

Displaying the form in jinja is much simpler and looks great.

<form method="POST" action="{{ url_for('auth.register') }}" accept-charset="UTF-8" role="form">
    {% for field in form %}
        {{ field(render_mode='horizontal', autocomplete='off') }}
    {% endfor %}
    <input type="submit" value="submit">
</form>

Available field types

  • SelectField
  • SelectMultipleField
  • RadioField
  • StringField / TextField
  • IntegerField
  • DecimalField
  • MoneyField
  • FloatField
  • BooleanField
  • DateTimeField
  • DateField (with bootstrap-datepicker)
  • TextAreaField
  • PasswordField
  • FileField
  • HiddenField
  • SubmitField
  • QuerySelectField
  • QuerySelectMultipleField
  • FieldList
  • FormField
  • TypeaheadField
  • ReadonlyTextField
  • MacField

Release files for wtforms-widgets 1.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wtforms-widgets 1.0.9
File Size Uploaded
wtforms_widgets-1.0.9.tar.gz 12.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wtforms-widgets 1.0.9
File Interpreter ABI Platform
wtforms_widgets-1.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 27.1 kB

Release files / wtforms_widgets-1.0.9.tar.gz

Download URL wtforms_widgets-1.0.9.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
13ae5c0e248729858b2090bf90ed7379a9bb88d20a94a3c4bab525070fb4e7b4
BLAKE2b-256 checksum
How to use checksums
2500bb085aab9839b04e93e4ead251eedb3a3f7f50eb4ffa815c092e5daddafe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.6

Release files / wtforms_widgets-1.0.9-py3-none-any.whl

Download URL wtforms_widgets-1.0.9-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34fbe29ff6efcf58bfc38957bf8e681f54ed6708e20e0aec3218c2d6e78fe35c
BLAKE2b-256 checksum
How to use checksums
914fae005c419347671e76735caa24fc5424d96b789488bc048b4cc5b3b87a3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.6

Release history Release notifications | RSS feed

This release

1.0.9 This release

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page