flask-admin

Flask Admin - how to set form_edit_rules or form_create_rules based on role of user?

这一生的挚爱 提交于 2021-01-20 12:10:27
问题 I am making simple ticketing system for medium-sized organization using Flask and sqlite together with SQLAlchemy. For backend managing of data I use Flask-Admin. The User and Ticket table looks like this: class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) role = db.Column(db.Integer, default=0) vmc_kom = db.Column(db.String(20)) name = db.Column(db.String(30), nullable=False) phone = db.Column(db.String, default="not") email = db.Column(db.String(40), nullable

Flask Admin - how to set form_edit_rules or form_create_rules based on role of user?

自古美人都是妖i 提交于 2021-01-20 12:09:42
问题 I am making simple ticketing system for medium-sized organization using Flask and sqlite together with SQLAlchemy. For backend managing of data I use Flask-Admin. The User and Ticket table looks like this: class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) role = db.Column(db.Integer, default=0) vmc_kom = db.Column(db.String(20)) name = db.Column(db.String(30), nullable=False) phone = db.Column(db.String, default="not") email = db.Column(db.String(40), nullable

Flask Admin - how to set form_edit_rules or form_create_rules based on role of user?

久未见 提交于 2021-01-20 12:07:30
问题 I am making simple ticketing system for medium-sized organization using Flask and sqlite together with SQLAlchemy. For backend managing of data I use Flask-Admin. The User and Ticket table looks like this: class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) role = db.Column(db.Integer, default=0) vmc_kom = db.Column(db.String(20)) name = db.Column(db.String(30), nullable=False) phone = db.Column(db.String, default="not") email = db.Column(db.String(40), nullable

Flask Admin - how to set form_edit_rules or form_create_rules based on role of user?

梦想与她 提交于 2021-01-20 12:07:16
问题 I am making simple ticketing system for medium-sized organization using Flask and sqlite together with SQLAlchemy. For backend managing of data I use Flask-Admin. The User and Ticket table looks like this: class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) role = db.Column(db.Integer, default=0) vmc_kom = db.Column(db.String(20)) name = db.Column(db.String(30), nullable=False) phone = db.Column(db.String, default="not") email = db.Column(db.String(40), nullable

How to override flask_admin style for all templates?

筅森魡賤 提交于 2020-12-10 16:03:53
问题 I'm working on simple web application and as for DB display I use Flask_admin module. I would like to apply custom CSS to all my templates e.g. Custom navar with blue border. This is how my index.html template looks like: {% block head %} {{ super() }} .navbar { border-color: #019ced; border-width: 1px; border-radius: 0; border-bottom-left-radius: 20px; border-bottom-right-radius: 20px; border-top: none; box-shadow: none; } {% endblock %} It works fine but I would like to apply this custom

How to override flask_admin style for all templates?

本秂侑毒 提交于 2020-12-10 16:03:41
问题 I'm working on simple web application and as for DB display I use Flask_admin module. I would like to apply custom CSS to all my templates e.g. Custom navar with blue border. This is how my index.html template looks like: {% block head %} {{ super() }} .navbar { border-color: #019ced; border-width: 1px; border-radius: 0; border-bottom-left-radius: 20px; border-bottom-right-radius: 20px; border-top: none; box-shadow: none; } {% endblock %} It works fine but I would like to apply this custom

Storing a PDF file in DB with Flask-admin

无人久伴 提交于 2020-06-09 15:22:14
问题 can I store PDF files in the database, as object or blob, with Flask-Admin? I do not find any reference in the documentation. Thanks. Cheers 回答1: Below is a self contained an example of storing files directly in a blob field via Flask-Admin. There is minimal error checking but it should get you going in the right direction. The important parts of the code: class BlobMixin(object): mimetype = db.Column(db.Unicode(length=255), nullable=False) filename = db.Column(db.Unicode(length=255),

Storing a PDF file in DB with Flask-admin

两盒软妹~` 提交于 2020-06-09 15:20:29
问题 can I store PDF files in the database, as object or blob, with Flask-Admin? I do not find any reference in the documentation. Thanks. Cheers 回答1: Below is a self contained an example of storing files directly in a blob field via Flask-Admin. There is minimal error checking but it should get you going in the right direction. The important parts of the code: class BlobMixin(object): mimetype = db.Column(db.Unicode(length=255), nullable=False) filename = db.Column(db.Unicode(length=255),

Flask-Admin view with many to many relationship model

扶醉桌前 提交于 2020-02-02 13:42:46
问题 I have this basic flask-admin set-up with users and user roles class Role(db.Model, RoleMixin): id = db.Column(db.Integer(), primary_key=True) name = db.Column(db.String(80), unique=True) description = db.Column(db.String(255)) class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String(255), unique=True) password = db.Column(db.String(255)) active = db.Column(db.Boolean()) confirmed_at = db.Column(db.DateTime()) roles = db.relationship('Role',

Flask-Admin view with many to many relationship model

倖福魔咒の 提交于 2020-02-02 13:42:26
问题 I have this basic flask-admin set-up with users and user roles class Role(db.Model, RoleMixin): id = db.Column(db.Integer(), primary_key=True) name = db.Column(db.String(80), unique=True) description = db.Column(db.String(255)) class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String(255), unique=True) password = db.Column(db.String(255)) active = db.Column(db.Boolean()) confirmed_at = db.Column(db.DateTime()) roles = db.relationship('Role',