GithubHelp home page GithubHelp logo

anioko / flask-dashed Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jeanphix/flask-dashed

0.0 2.0 0.0 1.04 MB

Provides simple but efficient admin UI.

Home Page: http://jeanphix.me/Flask-Dashed

flask-dashed's Introduction

Introduction

https://secure.travis-ci.org/jeanphix/Flask-Dashed.png

Flask-Dashed provides tools for build simple and extensible admin interfaces.

Online demonstration: http://flask-dashed.jeanphi.fr/ (Github account required).

List view:

https://github.com/jeanphix/Flask-Dashed/raw/dev/docs/_static/screen.png

Form view:

https://github.com/jeanphix/Flask-Dashed/raw/dev/docs/_static/screen-edit.png

Installation

pip install Flask-Dashed

Minimal usage

Code:

from flask import Flask
from flask_dashed.admin import Admin

app = Flask(__name__)
admin = Admin(app)

if __name__ == '__main__':
    app.run()

Sample application: http://github.com/jeanphix/flask-dashed-demo

Deal with security

Securing all module endpoints:

from flask import session

book_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)

Organize modules

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.

SQLALchemy extension

Code:

from flask_dashed.ext.sqlalchemy import ModelAdminModule


class BookModule(ModelAdminModule):
    model = Book
    db_session = db.session

book_module = admin.register_module(BookModule, '/books', 'books',
    'book management')

flask-dashed's People

Contributors

jeanphix avatar

Watchers

James Cloos avatar anioko1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.