Skip to main content

Decorators for flask-wtf

Project description

Flask-WTF-Decorators Build Status

Using decorators to validate form.

Installation

Using pip

pip install flask-wtf-decorators

Using Pipenv

pipenv install flask-wtf-decorators

Usage

Flask-WTF-Decorators is easy to use. You can define a view that requires validation.

from flask-wtf-decorators import FormValidator

form_validator = FormValidator()

@form_validator.validate_form(TestForm)
@app.route('/', methods=['GET', 'POST'])
def index(form):
    pass

You can tell Flask-WTF-Decorators what to do when a form is illegal. To do this you should provide a callback for error_handler.

@form_validator.error_handler
def error_handler(errors):
    return jsonify({'errors': errors}), 400

Test

python -m unittest discover -s tests

Contributing

Please submit a pull request to contribute.

License

This project is licensed under the MIT License.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

Flask_WTF_Decorators-0.1.2-py2.py3-none-any.whl (3.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file Flask_WTF_Decorators-0.1.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for Flask_WTF_Decorators-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9f17b431edd6f28dcea388dc8c8e02b422a1015084d0bd716fbbef457c5be7e7
MD5 f29d9f54b8349f3c8e5ac2e9363f75d3
BLAKE2b-256 e532238f799563d6dadce1513aed451ca613c4717c00870b813586dae92ce0f7

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