Questions tagged [flask-admin]

Flask-Admin is an extension for the Flask framework. It can be used for building admin interfaces easily, with model scaffolding support for many existing python ORMs. Use this tag for questions related to this extension only, and not for general 'admin' functionalities in Flask.

Flask-Admin is an advanced, extensible and simple to use 'administrative interface building' extension for the Flask framework.

It comes with batteries included: model scaffolding for SQLAlchemy, MongoEngine, pymongo and Peewee ORMs, a simple file management interface and a lot of usage examples.

You are not limited by the default functionality - instead of providing simple scaffolding for the ORM models, Flask-Admin provides tools that can be used to construct administrative interfaces of any complexity, using a consistent look and feel.

Documentation: https://flask-admin.readthedocs.io/en/latest/

GitHub: https://github.com/flask-admin/flask-admin

Issue tracker: https://github.com/flask-admin/flask-admin/issues

692 questions
12
votes
2 answers

Wrong dashboard while adding flask-admin to project

I'm trying to extend the flask-base project https://github.com/hack4impact/flask-base/tree/master/app. This uses the the application factory pattern in app/init.py and blueprints. In the app/init.py I have: import os from flask import Flask from…
user1592380
  • 34,265
  • 92
  • 284
  • 515
12
votes
1 answer

url_for for class-based views in Flask-Admin

I have a class-based Admin view: class All_RDPs(BaseView): @expose('/') def index(self): return 'ok1' @expose('/test') def testindex(self): return 'ok2' which is registered with Flask-Admin like…
kurtgn
  • 8,140
  • 13
  • 55
  • 91
12
votes
2 answers

flask admin custom QueryAjaxModelLoader

From what I understand, Flask Admin supports AJAX use for foreign key model loading. The Flask Admin - Model Documentation covers the basics under the heading form_ajax_refs. I have managed to use this successfully on many occasions, however I am…
Karim Tabet
  • 1,789
  • 1
  • 14
  • 35
12
votes
2 answers

Custom name of field in Flask-Admin

How can I customize field names in create/edit forms in Flask-Admin? I know how to change the table name: class User(db.Model): __tablename__ = 'user' id = db.Column('user_id', db.Integer, primary_key=True, autoincrement=True) …
Egregors
  • 403
  • 5
  • 10
12
votes
1 answer

Flask-Admin ModelView custom validation?

I'm studying Flask-Admin combined with PeeWee Backend ModelView (but my question may be applied to SQLAlchemy backend too), and there are two things I could not find in the docs or examples: (1). When I my model has an unique field and I test/try to…
weeanon
  • 821
  • 10
  • 17
12
votes
3 answers

How to make a field non-editable in Flask Admin view of a model class

I have a User model class and password is one attribute among many. I am using Flask web framework and Flask-Admin extension to create the admin view of my model classes. I want to make certain fields in the admin view like password non editable or…
ajay
  • 9,402
  • 8
  • 44
  • 71
12
votes
2 answers

Customize (override) Flask-Admin's Submit method from edit view

Preconditions: I'm new to Python and to Flask-Admin in particular. I created a simple test service, which has MondoDB, keeping the data with relationship of 'one-to-one' kind. employeeName -> salary The model looks like that: class…
makaron
  • 1,585
  • 2
  • 16
  • 30
12
votes
4 answers

flask-admin not showing foreignkey columns

class Parent(db.Model): id = db.Column(db.Integer, primary_key = True) name = db.Column(db.String(120)) def __repr_(self): return '' % (self.name) admin.add_view(ModelView(Parent, db.session)) class…
screenshot345
  • 598
  • 3
  • 9
  • 18
11
votes
1 answer

How can I avoid Flask-Admin 2.1 warning "UserWarning: Fields missing from ruleset"?

I'm using Flask-Admin 2.1 with Python 2.7.6. One of my Flask-Admin model classes inherits from flask.ext.admin.contrib.sqla.ModelView and overrides form_rules. When I run my application, this warning is displayed: "UserWarning: Fields missing from…
Steve Saporta
  • 4,581
  • 3
  • 30
  • 32
11
votes
4 answers

Flask-Admin Blueprint creation during Testing

I'm having trouble with the creation of blueprints by Flask-Admin when I'm testing my app. This is my View class (using SQLAlchemy) ## # All views that only admins are allowed to see should inherit from this class. # class AuthView(ModelView): …
arnoutaertgeerts
  • 2,232
  • 5
  • 29
  • 44
10
votes
3 answers

How to display column with results from many-to-many query in Flask/SQLAlchemy

I am trying to learn Python/Flask/SQLAlchemy by building a simple Wiki (heavily based off of a Flask-Admin example) but am struggling to understand how to get a new column from my many-to-many relationship to display. I have successfully created the…
you
  • 303
  • 2
  • 13
9
votes
1 answer

Customizing the flask admin row actions

I want to add another button next to the edit and delete icons on flask admin list view. In addition, I want to send that row data to a route as a post request. I know that I have to edit the admin/model/list.html template, but I am not getting how…
9
votes
1 answer

how to add flask-login to flask-admin

Login works great on my standard views, and the admin works great, but i can't seem to add login to my admin/yikes!!! It seems straightforward flask admin docs but when I add this section class MyView(BaseView): def is_accessible(self): …
Chet Meinzer
  • 1,691
  • 2
  • 21
  • 35
9
votes
1 answer

Flask-Admin Custom Select2 Ajax Field

I'm trying to extend a one-to-many field in my Flask-Admin app to use a custom Select2 Field. The javascript code for the field looks something like this: function format(data) { if (!data.id) return data.text; // optgroup return "
dvreed77
  • 2,217
  • 2
  • 27
  • 42
9
votes
2 answers

Flask-Admin extending templates

I'm trying to extend my template with 'master.html' template of Flask-Admin like this: {% extends 'admin/master.html' %} {% block body %} Hello!!! {% endblock %} And I get error: File…
Sleepwalker
  • 249
  • 2
  • 11
1
2
3
46 47