Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Utility Mixin 🌀

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.

Installation

The mixin is a single file, so you can just copy it into your project.

utility_mixin.py

Setup of this project

  • Clone the repository
  • install the dependencies

Commands

Create the database

flask init

Reset the database

flask reset

Show all records

flask all

Show records using pagination

flask page
# or
flask page 2
# adding a number to the end will select the page, page 1 is default

Show 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 default

Load fake records

flask load
# or
flask load 10
# adding a number to the end will select the number of records to load, 1 is default

Update a random record using the classmethod

flask update-cls

Update a random record using the instance method

flask update-inline

Delete a random record

flask delete

About

A Utility Mixin for Flask-SQLAlchemy

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages