- Notifications
You must be signed in to change notification settings - Fork25
Provides simple but efficient admin UI.
NotificationsYou must be signed in to change notification settings
jeanphix/Flask-Dashed
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Flask-Dashed provides tools for build simple and extensible admin interfaces.
Online demonstration:http://flask-dashed.jeanphi.fr/ (Github account required).
List view:
Form view:
pip install Flask-Dashed
Code:
from flask import Flaskfrom flask_dashed.admin import Adminapp = Flask(__name__)admin = Admin(app)if __name__ == '__main__': app.run()
Sample application:http://github.com/jeanphix/flask-dashed-demo
Securing all module endpoints:
from flask import sessionbook_module = admin.register_module(BookModule, '/books', 'books', 'book management')@book_module.secure(http_code=401)def login_required(): return "user" in session
Securing specific module endpoint:
@book_module.secure_endpoint('edit', http_code=403)def check_edit_credential(view): # I'm now signed in, may I modify the ressource? return session.user.can_edit_book(view.object)
As admin nodes are registered into a "tree" it's quite easy to organize them.:
library = admin.register_node('/library', 'library', my library)book_module = admin.register_module(BookModule, '/books', 'books', 'book management', parent=library)
Navigation and breadcrumbs are automatically builds to feet your needs. Child module security will be inherited from parent one.
Code:
from flask_dashed.ext.sqlalchemy import ModelAdminModuleclass BookModule(ModelAdminModule): model = Book db_session = db.sessionbook_module = admin.register_module(BookModule, '/books', 'books', 'book management')
About
Provides simple but efficient admin UI.
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.