Reputation: 1
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 admin) but viewing and editing different information. A name collision between Blueprint errors shows up, when I try to run Flask admin twice.
Upvotes: 0
Views: 354
Reputation: 2074
For avoiding collisions you can use the endpoint
param when adding your views.
Let's say you have two classes AdminModelView
and ManagerModelView
. They both extend BaseModelView and take as first positional argument the same model (e.g. Model
).
Under these assumptions you can do something like this:
...
admin.add_view(AdminModelView(Model, ..., endpoint="admin"))
admin.add_view(ManagerModelView(Model, ..., endpoint="manager"))
...
where admin
is an instance of Admin
from flask_admin
.
Upvotes: 0