Skip to main content

Decorator driven wtforms extension with Bootstrap 5 support for Flask

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wtforms_widgets-1.0.9.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wtforms_widgets-1.0.9-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file wtforms_widgets-1.0.9.tar.gz.

File metadata

  • Download URL: wtforms_widgets-1.0.9.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.6

File hashes

Hashes for wtforms_widgets-1.0.9.tar.gz
Algorithm Hash digest
SHA256 13ae5c0e248729858b2090bf90ed7379a9bb88d20a94a3c4bab525070fb4e7b4
MD5 db01120e396bf01069764219fb5dc5b1
BLAKE2b-256 2500bb085aab9839b04e93e4ead251eedb3a3f7f50eb4ffa815c092e5daddafe

See more details on using hashes here.

File details

Details for the file wtforms_widgets-1.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for wtforms_widgets-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 34fbe29ff6efcf58bfc38957bf8e681f54ed6708e20e0aec3218c2d6e78fe35c
MD5 746df2e2b1bac5e3a8488ef8d2fdeee0
BLAKE2b-256 914fae005c419347671e76735caa24fc5424d96b789488bc048b4cc5b3b87a3e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page