Simple Admin Panel for Flask
Project description
Flask-Admin-Panel
A Flask extension that enables Admin Panel for Registed Flask-SQLAlchemy Models.
Example
Setting up the Flask-Admin-Panel is simple:
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_admin_panel import FlaskAdminPanel
app = Flask(__name__)
app.config["SECRET_KEY"] = "<replace with a secret key>"
app.config["APP_ADMIN_USER"] = "<replace with a your user name default is admin>"
app.config["APP_ADMIN_PASSWORD"] = "provide a strong password"
app.config["SQLALCHEMY_DATABASE_URI"] = "provide a sql alchemy database uri"
db = SQLAlchemy(app)
adminpanel = FlaskAdminPanel(app,db)
Registring the models to Flask-Admin-Panel :
#Create any model
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(80), unique=True, nullable=False)
email = db.Column(db.String(120), unique=True, nullable=False)
def __repr__(self):
return '<User %r>' % self.username
# Provide unique name to model and SQLAlchemy.Model class
adminpanel.serv_admin_panel.register_model_for_admin_panel("User",User)
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
flask_admin_panel-0.1.0.tar.gz
(18.9 kB
view hashes)
Built Distribution
Close
Hashes for flask_admin_panel-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cf02556aa55c32313f0b23ce64d2457edc757a8d3276102b70163211d0e04c0 |
|
MD5 | 7a773f064d94c8b70b83830167d750cc |
|
BLAKE2b-256 | 31e7c18bbb054fcda66b8b80953b67c38ddcd286fc44d89c0f60a8c8c98860d8 |