https://github.com/sr1871/flask-model-validation
Extension for Flask-SQLALchemy that include validation for models, a easier way to query and more new features.
https://github.com/sr1871/flask-model-validation
flask flask-model-validation flask-sqlalchemy python sqlalchemy
Last synced: 5 months ago
JSON representation
Extension for Flask-SQLALchemy that include validation for models, a easier way to query and more new features.
- Host: GitHub
- URL: https://github.com/sr1871/flask-model-validation
- Owner: sr1871
- Created: 2023-05-23T05:59:43.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-23T06:37:52.000Z (about 3 years ago)
- Last Synced: 2024-04-26T07:45:27.652Z (about 2 years ago)
- Topics: flask, flask-model-validation, flask-sqlalchemy, python, sqlalchemy
- Language: Python
- Homepage:
- Size: 46.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Flask-model-validation
Flask-model-validation is an extension for [Flask-SQLAlchemy](https://github.com/pallets-eco/flask-sqlalchemy) that adds support for validating the model before commit it to the database. It adds new functions to query and save the model easily.
## Installation
Install using [pip](https://pip.pypa.io)
```bash
pip install Flask-model-validation
```
## Setup the extension
It should be initialized like `Flask-SQLAlchemy` extension.
For more information see the [Flask-SQLAlchemy documentation](https://flask-sqlalchemy.palletsprojects.com/en/3.0.x/)
```python
from flask import Flask
from flask_model_validation import SQLAlchemyModelValidation
app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite://"
db = SQLAlchemyModelValidation()
db.init_app(app)
```
## Features
Flask-model-validation includes several new features.
- [Validation](docs/validation.md)
- [Mixins](docs/mixins.md)
- [Saving the model](docs/save.md)
- [Deleting the model](docs/delete.md)
- [Extra model features](docs/model_features.md)
- [query to the database](docs/query.md)
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
## License
[MIT](https://choosealicense.com/licenses/mit/)