Data validator for Flask using SQL-Alchemy, working at Model component with events
Project description
Description
Data validator for Flask using SQL-Alchemy, working at Model component with events, preventing invalid data in the columns.
Instalation
pip install flask-validator
Documentation
For the online documentation, follow this link
Basic usage
from flask_validator import ValidateInteger, ValidateString
class User(db.Model):
__tablename__ = 'user'
id = db.Column(db.Integer, primary_key=True)
string = db.Column(db.String(80))
integer = db.Column(db.Integer())
def __init__(self, string, integer):
self.string = string
self.integer = integer
@classmethod
def __declare_last__(cls):
ValidateInteger(User.integer)
ValidateString(User.string)
Available Constraints
ValidateInteger
ValidateNumeric
ValidateString
ValidateBoolean
ValidateLenght
ValidateLessThan
ValidateLessThanOrEqual
ValidateGreaterThan
ValidateGreaterThanOrEqual
ValidateEmail
ValidateRegex
ValidateIP
ValidateURL
ValidateUUID
ValidateCountry
ValidateTimezone
ValidateLocale
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Flask-Validator-0.6.tar.gz
(4.3 kB
view hashes)