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
Filter by
Sorted by
Tagged with
0 votes
2 answers
493 views

Flask-Admin: How to get the object being edited in validate_form

I am trying to implement custom validation in the edit form. However, I don't know how to obtain the object that is being edited in the method validate_form. class ShiftModelView(ModelView): "...
lmiguelvargasf's user avatar
0 votes
1 answer
396 views

Flask-Admin: add filter for parent's field

I need to apply a filter based on a parent's field, i.e., I need to filter by Driver's name (parent) in the model view for the Shift model (child). These are my models: import datetime from ...
lmiguelvargasf's user avatar
0 votes
1 answer
281 views

Flask Admin multiple admin pages

Is there a way to create multiple admin pages using Flask admin library. For example, I have 2 user role ( Admin, Manager). I want these two user roles to have access to the admin page(using Flask ...
user19561166's user avatar
0 votes
1 answer
545 views

Flask Admin and SQLAlchemy relationship advice, how do I get columns from a grandparent table?

Using Flask Admin, I'm having difficulties understanding how to retrieve columns from parent and grandparent tables to use for filtering / create dropdowns class Project(db.Model): project_id=db....
Jason's user avatar
  • 1
0 votes
1 answer
121 views

Securing Flask-Admin When Using Blueprints and Application Factory

I've set up Flask Admin and it is working, but am struggling with adding authentication. There are several tutorials I've followed but can't seem to get them to work with how I've set up my app. Per ...
MightyModest's user avatar
0 votes
1 answer
682 views

Load additional select field and data entries on flask admin edit and create form

I have a model Parent with a Category attribute and a model Unrelated with many entries. In Flask-admin i need to extend or replace the edit/create functionality in such a way that i can have an ...
NicolasZ's user avatar
  • 923
1 vote
1 answer
478 views

How to override flask_admin ModelView.get_list to get custom amount of entries

Now i get all entries in admin when i open page of MyView(ModelView). I want to manage this behaviour and get only, for example, 10 entries. I tried to override ModelView.get_query method in MyView ...
ervand7's user avatar
  • 21
0 votes
1 answer
202 views

Flask Admin field doesnt populate on create_form

I have a flask-sqlalchemy model and I want to pre-populate the id field with a default entry when creating a new entry. I tried the following but it doesnt seem to work. class Readergroup(BaseModel): ...
Omar Abdelrazik's user avatar
9 votes
2 answers
11k views

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 ...
Sam Archer's user avatar
-1 votes
1 answer
813 views

I have created a variable is_admin which is false by default and admin page is accessible only when is_admin is true

My error is :-AttributeError: 'AnonymousUserMixin' object has no attribute 'is_admin' I have been assigned a task of user and admin in flask framework . is _admin variable is defined in class as a ...
Kenil Shah's user avatar
2 votes
0 answers
224 views

How to use Blueprints with Flask-Admin

How can I get Flask-Admin to work with blueprints? Here is a minimum, reproducible example: from flask import Flask, Blueprint from flask_admin import Admin app = Flask(__name__) bp = Blueprint('bp',...
Matthew Moisen's user avatar
-1 votes
1 answer
83 views

I want to implement manager class. So when we create user, we can define manager and under that defined manager we will create user

roles users = db.Table( 'roles_users', db.Column('user_id', db.Integer(), db.ForeignKey('user.id')), db.Column('role_id', db.Integer(), db.ForeignKey('role.id')) ) Above mentioned code is ...
Kenil Shah's user avatar
0 votes
1 answer
187 views

How to build flask admin panel each for superadmin and admin?

Below code can give access to superadmin: What if I have to build another admin page for role admin which is created by superamin class MyModelView(sqla.ModelView): def is_accessible(self): return ...
Kenil Shah's user avatar
1 vote
0 answers
106 views

Flask Admin - dependent dropdown

I am trying to create a dependent dropdown in a specific Form in Flask Admin. I'd like to choose a value from a dropdown 1 and automatically fill a dropdown 2. I got the dropdown 2 updating by ...
ar.olivesilva's user avatar
1 vote
1 answer
994 views

with flask admin tab create user, use the security.database.create_user method to update or create

Im trying to se flask-admin and flask-security-too and use the Views from flask-admin to administrate the users and its roles the problem is that, the view from flask-admin is trying to update or ...
FalkZerd's user avatar
-1 votes
1 answer
329 views

Flask-Admin returns "ValueError: Invalid format string" on clicking create for any model

I have an existing Flask project which uses SQLAlchemy and I wanted to interate an Admin dashboard. Everything worked fine, I managed to enable authentication by using the ModelView Class however if I ...
Adithya Narayan's user avatar
1 vote
0 answers
546 views

Flask-Admin - How can I create a custom InlineModelForm that generates a dynamic field per related db record

I'm trying to create dynamic inline fields based on a model (Parameter) and populate the corresponding dynamically-created field with the value from the related ParameterValue model. Where I'm stuck ...
CaffeinatedMike's user avatar
1 vote
0 answers
213 views

Flask admin input field to choose file field

I'm using cloudinary to store my images. My image column in database is String so default flask-admin input field for image is text field. How do I change the image text input field to upload image ...
ngocphuc.nguyen256's user avatar
0 votes
1 answer
173 views

Problem with adding new instance to DB with Flask-Admin [duplicate]

I have a little problem with adding new instances using flask-admin. My model is: class MenuCategory(db.Model): id = db.Column(db.Integer, primary_key=True) name_category = db.Column(db....
hungry7's user avatar
  • 61
0 votes
1 answer
131 views

Flask-Admin Adding new Keyword in Proxy Association

Would any know the best way to achieve the following with flask-admin I have two models User and Keyword which have a relationship one to many. What I want to do is in the create or edit form allows ...
user avatar
0 votes
1 answer
423 views

Flask-Admin column_formatters not called

I'm using Flask-Admin and would like to add an extra field to my inline model view. Purpose is to display an Image from the filesystem. Issue is that my column formatter is never called and the image ...
shalama's user avatar
  • 1,263
2 votes
1 answer
3k views

Python Flask flask-admin wtforms.validators AttributeError

Im going through Flask based tutorial "Learn flask framework" by Matt Copperwaite and now am stuck in following error. After adding Flask-Admin I started to build admin dashboard with it. I ...
Arkenston's user avatar
0 votes
1 answer
878 views

How can I create a ModelView in Flask-Admin whose url contains a variable prefix and use that variable to do the initial filtering?

I have the following (simplified) structure in version one of an app that I'm working on porting over much of the logic to Flask-Admin for version two: Portals This is the base resource for all ...
CaffeinatedMike's user avatar
1 vote
1 answer
943 views

Flask-admin: Is it possible to apply filters (which can be disable) to a view/endpoint by default

I would like to know how to get a filter applied by default when I access a page. I want this filter to be able to be disabled. Some sample code below: from flask import Flask from flask_admin import ...
PicxyB's user avatar
  • 694
1 vote
1 answer
813 views

Displaying joined fields in Flask-Admin ModelView

I have a Flask app using Flask-SQLAlchemy with some simple relational data mapping, e.g. between Orders and OrderItems belonging to those orders. In my Flask-Admin backend I would like to show some of ...
kontur's user avatar
  • 5,118
0 votes
1 answer
376 views

Why are some of my flask-sqlalchemy tables not setting postresql primary key to serial?

I have a postgresql database with some simple tables in it. I'm using flask-sqlalchemy as my ORM and I use flask-migrate to update when I make changes to the schema. If I look at my tables using ...
calabash's user avatar
  • 403
1 vote
1 answer
602 views

How can I customise flask-admin to add it to a sb-admin themed app

I have an existing application that I want to add flask-admin too and retain the same look and feel in the admin interface. Ideally I'd have the admin interface retain the side menu from the ...
calabash's user avatar
  • 403
1 vote
2 answers
376 views

How can I make the Flask-admin panel use the init method of the model?

When I add a new collection through Flask-admin panel I don't get the init method to reduce the image through another function. And when I add a new collection through the Python console everything ...
nnekkitt's user avatar
0 votes
1 answer
99 views

Two HTML buttons but first button is always sent

For some reason I've been struggling with this, I've made all sorts of attempts and searched a bunch of answers but nothing seems to be working correctly. Question: There are two buttons on a page ...
mrp's user avatar
  • 691
0 votes
1 answer
777 views

flask-admin custom form action and kick off background processes

I'm fairly new to flask-admin and would like to create a batch action for a view that will primarily do two things: update the Status of the selected record(s) in the table that the action is "...
mrp's user avatar
  • 691
0 votes
1 answer
261 views

flask_admin db model not showing when logged in as admin

I am trying to create an authentication function to my Flask webapp. I did some research and ended up using flask_admin integrated with flask_security. My app worked just fine after I added rolebased ...
Mohammed's user avatar
  • 333
0 votes
2 answers
429 views

Problem Using QuerySelectMultipleField in Flask-Admin Edit Form

I'm newly come to Flask-Admin, and I'm trying to customize a model edit form. My User model has a roles attribute which is a relationship through the role_users table to Role.name, with a foreign key ...
Darwin von Corax's user avatar
1 vote
1 answer
721 views

flask-admin "AdminIndexView" not working to restrict the /admin page

this is my first question in stackoverflow. i need to change flask_admin's default page but it's not working, i want to make it inaccessible for non-admin users... admin file: from flask import ...
João Victor's user avatar
0 votes
2 answers
537 views

Flask-Admin Bootstrap 4 X-editable date causes error

@Joes I think I've found an error/bug in Flask-Admin's X-editable dates, but only in Bootstrap 4. Notice in the below code, template_mode='bootstrap3' works fine, but `template_mode='bootstrap4' ...
Sean McCarthy's user avatar
1 vote
0 answers
94 views

Flask-Admin not working on Production server (CSS and JS not loading)

I'm facing a problem with Flask Admin. Here is the problem: When running Flask on localhost, everything works fine but once in production, all the static file from Flask-admin are not loading properly....
WillouDelWillou's user avatar
2 votes
1 answer
177 views

How can we NOT display certain rows in a flask-admin view?

I have been searching and trying for a while but could not find any answer so any help is appreciated. I have a flask admin-view, say the following: class testViewMain(): column_list = [ '...
Hussein Hammoud's user avatar
0 votes
1 answer
105 views

I can not alter is_accessible in Flask-admin

After having is_accessable return false, I can still access the User table. What am I doing wrong? class User(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(...
forest's user avatar
  • 11
1 vote
1 answer
281 views

change after successful delete flash message in flask-admin

how to change after successful delete flash message in flask-admin? flash(ngettext('Record was successfully deleted.', '%(count)s records were successfully deleted.', ...
Suren Abrahamyan's user avatar
0 votes
1 answer
478 views

How can add admin row action in flask-admin

i've fallowing this post Customizing the flask admin row actions but i always got jinja2.exceptions.TemplateNotFound: my_list.html. i don't know why. from app import db, app from flask_admin import ...
Sebastian Henao's user avatar
1 vote
1 answer
757 views

flask-admin different view for multiple databases

I have two different databases. They are: stock and commodity. Each database has two tables as follows: Stock: User_trade_stock, stock_prices Commodity: User_trade_commodity, commodity_prices I try ...
gdv19's user avatar
  • 57
1 vote
0 answers
472 views

AttributeError: module 'app.models.PostModel' has no attribute '_sa_class_manager'

I was trying to add flask-admin to my application. I am getting the following error Traceback (most recent call last): File "/run/media/sanifss/4264239664238C2B/Projects/Personal/Portfolio/run....
Sanif SS's user avatar
  • 622
1 vote
1 answer
2k views

Python Flask logging to multiple files

I have a flask application, which calls 2 functions from 2 different files. I've setup logging to 2 different files. However, the logging always seems to append to one file (whatever end point is hit ...
Shine's user avatar
  • 83
0 votes
1 answer
1k views

Flask Admin need HTML5 color picker field

I'm using Flask-Admin to create views of my database tables. One of our tables has a "color" column and it's "editable" meaning if you click on it, you can edit the text directly ...
Sean McCarthy's user avatar
0 votes
1 answer
336 views

Python3 flask_admin : How to avoid unauthorized users view the admin page?

Recently, I'm using python flask to build a simple website But I'm confuse about how to avoid users who is unauthorized from seen the admin page Although override is_visible and is_accessible function ...
Koios1143's user avatar
0 votes
1 answer
253 views

SQLAlchemy SQL expression with JSONB query

I have the following property on a flask-sqlalchemy model. I want to make this approved_at property a sortable column in flask-admin, but apparently I need to convert this to a hybrid property using ...
Dan Gayle's user avatar
  • 2,317
0 votes
0 answers
371 views

How to display data in flask custom admin template view

I retrieve data from the database and want to show the data into the flask admin template. But the data can not be displayed in the admin template. Also, the admin route cant accept POST REQUEST. How ...
ijaz Bacha's user avatar
0 votes
0 answers
458 views

Securing Flask-Admin with Flask-HTTPAUTH

So I have looked everywhere for this but I couldn't find an answer. I have recently integrated flask-admin to my flask application, which is already, partly secured using flask-httpauth's basic ...
Kais Ben Daamech's user avatar
1 vote
1 answer
218 views

Flask-admin with mongoengine show roles as 'Role object' instead of the respective role name

I am using flask-security and is now adding flask-admin. I have my user view and my roles view. I can create users and roles. But the roles don't show as the respective role names in the user dropdown ...
aquatic7's user avatar
  • 615
0 votes
1 answer
292 views

Flask-Admin - what to pass in url_for(' ')? [closed]

I got an error, that says, that no URL can be build from that parameter inside url_for(''). I passed url_for('admin') but that does not work. What should I pass to get to localhost:5000/admin ? Thank ...
thale00's user avatar
  • 33

1
2
3 4 5
14