master
.I have an application with the option of extensions. My idea was to have an admin page for the main application and separate admin pages for the extensions.
You can have multiple instances of Admin
running, but the links to the Views on the left point to wrong URL's.
Start the app
The Views are working correctly, when accessing with the url
The navigation results in wrong url
http://localhost:8000/admin1/user2/list
from fastapi import FastAPI
from sqlalchemy import Column, Integer, String, create_engine
from sqlalchemy.orm import declarative_base
from sqladmin import Admin, ModelView
# DB -------------------------------------------------------------------------
Base = declarative_base()
engine = create_engine(
"sqlite:///example.db",
connect_args={"check_same_thread": False},
)
class User1(Base):
__tablename__ = "users1"
id = Column(Integer, primary_key=True)
name = Column(String)
class User2(Base):
__tablename__ = "users2"
id = Column(Integer, primary_key=True)
name = Column(String)
Base.metadata.create_all(engine) # Create tables
# Main App -------------------------------------------------------------------
app = FastAPI()
# Admin ----------------------------------------------------------------------
admin1 = Admin(app, engine, base_url="/admin1")
admin2 = Admin(app, engine, base_url="/admin2")
class UserAdmin1(ModelView, model=User1):
column_list = [User1.id, User1.name]
class UserAdmin2(ModelView, model=User2):
column_list = [User2.id, User2.name]
admin1.add_view(UserAdmin1)
admin2.add_view(UserAdmin2)
No response
No response
No response
Tested on Windows, I could also test on Linux
3.10.2
0.16.1
No response
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too