This is a utility mixin that provides CRUD and JSON operations for your models.
It requires Flask-SQLAlchemy to be installed, as it makes use of the paginate method.
The mixin is a single file, so you can just copy it into your project.
- Clone the repository
- install the dependencies
Create the database
flask initReset the database
flask resetShow all records
flask allShow records using pagination
flask page
# or
flask page 2
# adding a number to the end will select the page, page 1 is defaultShow records using pagination, return a JSON friendly dict
flask page-json
# or
flask page-json 2
# adding a number to the end will select the page, page 1 is defaultLoad fake records
flask load
# or
flask load 10
# adding a number to the end will select the number of records to load, 1 is defaultUpdate a random record using the classmethod
flask update-clsUpdate a random record using the instance method
flask update-inlineDelete a random record
flask delete