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
6
votes
3 answers

Flask-Admin: route to models view with filter applied

I have a model in Flask-Admin with filter (e.g. based on Foreign Key to other model). I want to generate links from front-end to this model view in admin with filter value applied. I noticed that it adds ?flt0_0= to the url, so that the whole…
vdikan
  • 75
  • 1
  • 5
6
votes
1 answer

flask-admin: Render inline_models as list view?

I have a Motion model which has many Votes. I display the votes as an inline_model in flask-admin. Is it possible to render the votes as a table like in the list_view template? Instead of like this:
Mick
  • 118
  • 6
6
votes
1 answer

Change order of columns in Flask-Admin list view

I have a Flask-Admin list view (ModelView) of my user model with some fields excluded, custom headers, etc. Everything's working correctly and I've overridden the default list template so I can match the styling of the rest of the application.…
ruhee
  • 73
  • 3
  • 7
6
votes
1 answer

Flask-Admin / Flask-SQLAlchemy: set user_id = current_user for INSERT

Using Flask-Admin + Flask-SQLAlchemy I have defined three models: User, Apikey, Exchange. When an authenticated user creates a new Apikey through the web admin interface I'd like that the user_id on this new row that's inserted in the database is…
Unai
  • 181
  • 1
  • 11
6
votes
1 answer

Flask Admin ModelView different fields between CREATE and EDIT

In a Flask app using Flask Admin I would like to be able to define different form fields in the Edit section of a ModelView than those in the Create section. The form_columns setting applies to both Create and Edit, but I can't seem to find a way to…
RobertoCuba
  • 881
  • 9
  • 25
6
votes
1 answer

Filter and Sort on Custom Field in Flask-admin ModelView

I want to add filters for amount (custom field) in Model View class FarmerAdmin(ModelView): column_descriptions = dict(amount = "All Transactions Total (Rs.)") column_searchable_list = ('name','village','phone') column_editable_list =…
shmundada
  • 61
  • 5
6
votes
2 answers

How to handle ordered many-to-many relationship (association proxy) in Flask-Admin form?

I have a many-to-many relationship between declarative models Page and Survey, which is mediated by association proxies because the order in which pages appear in a survey is important, so the cross-linking table has an additional field. from…
Julian
  • 4,176
  • 19
  • 40
6
votes
1 answer

Why does flask-admin require a ListField of mongoengine to have a field type?

I am trying to use flask-admin, which seems great and easy, but I have a problem. I have a field in a collection which is defined as a ListField(), with an implicit type of None for the list field type. The reason I am not defining a type for the…
Oren Solomianik
  • 385
  • 3
  • 8
6
votes
1 answer

Flask-Admin - Customizing views

I'm developing a web-app using Flask and pyMongo, and I've recently started to integrate the Flask-Admin module (1.0.4), given the fresh mongodb support. All is smooth and fine when using ModelViews, but when it comes to subclassing a BaseView I…
user1981924
  • 826
  • 11
  • 17
5
votes
1 answer

How to override delete logic on Flask Admin?

I have been searching on Google and StackOverflow about this. Basically, I want to try and override the delete function on Flask-Admin to not actually delete a record, but instead update a row of the object called 'deleted_by' and 'deleted_on'. I…
Lucas Arruda
  • 533
  • 1
  • 8
  • 15
5
votes
2 answers

How to extend Flask-admin model Edit and Create templates?

according to the flask-admin docs I can extend the main flask-admin dashboard by creating the file templates/admin/index.html and extending admin/master.html. The HTML would look like this: {% extends 'admin/master.html' %} {% block body %} …
Marcelo Fonseca
  • 1,705
  • 2
  • 19
  • 38
5
votes
3 answers

How to add an extra field in the edit form in Flask Admin?

I want to add a field projects to my User edit form with Flask Admin. To do so I tried to override the edit_form method to add the field as an additional attribute to the form, but the field is not added. I cannot find any clear documentation about…
jul
  • 36,404
  • 64
  • 191
  • 318
5
votes
0 answers

Is possible to use column_formatters in edit view in Flask Admin?

Is possible to use column_formatters in edit view in Flask Admin? When I add the following code it is rendering "random" in the list form view. But when it renders the edit view this field is raw not using the column_formatters. I debugged it and…
Esteban S
  • 1,859
  • 5
  • 22
  • 43
5
votes
0 answers

Flask admin show inline_models as list

I try to create a Flask-Admin view with inline_models. This works, but it renders the inline item by item. class MyViewFeatureEngineering(sqla.ModelView): inline_models = ((Feature_columns),) But I would like to show it as a list. It can be…
szeta
  • 589
  • 1
  • 5
  • 21
5
votes
1 answer

Conditionally allow editing in the list view for Flask admin ModelView

I can have a property like so in the view class: class MyExampleView(ModelView): @property def can_edit(self): # Return True or False based on some conditional logic How can I access the row's attribute so I can for example…
user1087973
  • 800
  • 3
  • 12
  • 29