A Flask extension to generate CRUD routes based on models.
Project description
Flask Crud Generator
Allow you to generate CRUD routes based on your models in a Flask application
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_crud_generator import CRUDGenerator
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
crud = CRUDGenerator(app, db)
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80))
email = db.Column(db.String(120), unique=True)
def to_dict(self):
return {'id': self.id, 'name': self.name, 'email': self.email}
class Product(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80))
def to_dict(self):
return {'id': self.id, 'name': self.name}
crud.generate_routes(User)
crud.generate_routes(Product)
with app.app_context():
db.create_all()
if __name__ == '__main__':
app.run(debug=True)
Then go to locahost:5000/user or locahost:5000/product
Todos :
- [] Supports models relationships
- [] generate HTML views with basics / WTForms
- [] Custom data validations
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
Built Distribution
Close
Hashes for flask_crud_generator-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ab64c36053cec8db80a2a9d5f865b5a83f549080be588b9591160e872ca0aaf |
|
MD5 | 8e6d3d51319a8083f79871b782f3dcd8 |
|
BLAKE2b-256 | 04d1bad6733dd977c75a91c5461302f701c1b5d0f198301c4813feb79ec53c0f |
Close
Hashes for flask_crud_generator-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7280c2d02079488f2ee4bc5e156f2016e908b959c6854ade94ee5374bcbe645f |
|
MD5 | 937ebed29eb33f15cc9dc41d8d227a61 |
|
BLAKE2b-256 | 786dcac3958ec883446c514c4a6399481aa7919784581108ea6e8e8b8b9138a7 |