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
9
votes
1 answer

Flask-Admin & Authentication: "/admin" is protected but "/admin/anything-else" is not

I'm trying to customize my Admin views with Flask and Flask-SuperAdmin, however, the index view and subviews are apparently not using the same is_accessible method: EDIT: I managed to figure out what I was doing wrong. I needed to define…
Brian
  • 555
  • 4
  • 18
8
votes
1 answer

Flask Admin extend "with select"-dropdown menu with custom button

Im using the built-in view of flask admin. As you can see in the picture below: What Im trying is simple: I just want to extend the dropdown menu with a custom button. This button should perfome some action on all selected items. Is there are…
Cube
  • 109
  • 1
  • 10
8
votes
0 answers

Flask-Admin Cannot find reverse relation

I already have an application using my SQLAlchemy model, and I'm now trying to add a flask admin website on top to manage some of the data in the DB. This model is already setup and working throughout the existing application so I know the…
chop4433
  • 211
  • 1
  • 2
  • 4
8
votes
2 answers

Multiple choices in flask-admin form_choices

Well, I recently approached to flask-admin and I cannot figure out how to solve this issue. I know that I can use form_choices to restrict the possible values for a text-field by specifying a list of tuples. Anyway, form_choices allows to select…
Pankus
  • 1,277
  • 1
  • 12
  • 17
8
votes
1 answer

Custom Flask-Admin form with some select field choices set according to another select field

I am trying to use Flask-Admin to create a create/edit form for the model Matriline shown below. This model has a string field name and a field pod_id with a foreign key constraint to another model Pod, which itself has a foreign key field to a Clan…
jul
  • 36,404
  • 64
  • 191
  • 318
8
votes
3 answers

Flask Admin Custom Form Validation for Multiple Fields?

I have been intending to create a custom form validation logic that's based on multiple field values (in my case, 2 fields to ensure date range data integrity is ensured, I.E. start_time < end_time). However, flipping through the documentation on…
Devy
  • 9,655
  • 8
  • 61
  • 59
8
votes
2 answers

How can I turn a string model field into a select input in Flask-Admin?

I have a string field in my SQLAlchemy model and I would like to expose a select box with a few options in Flask-Admin instead of the standard text field. class MyModel(db.Model): id = db.Column(db.Integer, primary_key=True) my_field =…
nickromano
  • 918
  • 8
  • 16
8
votes
4 answers

Select2 field implementation in flask/flask-admin

I'm trying to implement Select2 field in one of my flask views. Basically I want the same select2 field in my flask application view (not a flask admin modelview) as in Flask-admin model create views. Currently my solution has been QuerySelectField…
fbeastz
  • 81
  • 1
  • 3
8
votes
5 answers

How do I add flask-admin to a Blueprint?

for example: from flask import Flask from flask.ext.admin import Admin, BaseView, expose class MyView(BaseView): @expose('/') def index(self): return self.render('index.html') app = Flask(__name__) admin =…
Shirley
  • 81
  • 1
  • 3
7
votes
2 answers

Why is my Flask app crashing with ImportError: cannot import name 'contextfunction' from 'jinja2'

I have a Flask app deployed on Azure. Without changing any of the dependencies I'm suddenly getting this error, ImportError: cannot import name 'contextfunction' from 'jinja2'. Seems to be related to Flask-admin: [2022-03-27 07:22:27 +0000] [7]…
Sam Archer
  • 149
  • 2
  • 10
7
votes
1 answer

Flask-admin batch action with argument via pop-up modal window

Is there any way to initiate a pop-up window from a Flask function? I have a flask-admin + flask-sqlalchemy app. A table in the DB contains a field foo with some values. I have a UserAdmin view and I'm trying to create a batch action with some…
Yury Kirienko
  • 1,810
  • 1
  • 22
  • 32
7
votes
3 answers

flask-admin: How to make columns read-only according to other columns' value?

I've built a system that allows users to apply for code review and wait for manager to approve. And now what I want to achieve is as below: If it's approved, then all the fields become read-only(I manually set Project name as read-only…
Samoth
  • 716
  • 15
  • 34
7
votes
1 answer

Flask-admin - how to change formatting of columns - get URLs to display

Question on flask-admin. I setup flask-admin and one of the models i created is pulling urls and url titles from a mysql database. Using flask-admin, how to i get flask-admin to render the urls instead of just text? So make it easier for users to…
chesco111
  • 71
  • 1
  • 2
7
votes
2 answers

Flask-Admin Role Based Access - Modify access based on role

I took the Flask-Admin auth example from here and changed it slightly. I added the following block to the view below, but it doesn't show the export button. I was expecting it to add the export option to the admin views. It does print ---superuser…
David Gleba
  • 517
  • 1
  • 5
  • 21
7
votes
1 answer

Flask-admin inline modelling passing form arguments throws AttributeError

Hi there fellow Flask developers! In Flask-admin, I currently try to implement inline model editing into my model view. On the model side, I have a simple tree structure that represents a set of content pages. Each node has several child nodes and…
RobinWeiss
  • 71
  • 1
  • 2
1 2
3
46 47