Is it possible to get FastApi global state? #517
-
Hi, Is it possible to get FastAPI global state inside ModelView events? Thank you in advance! |
Beta Was this translation helpful? Give feedback.
Answered by
rossmacarthur
Jul 7, 2023
Replies: 1 comment
-
Also had this issue, I had to attach the FastAPI app to the admin app to be able to access it in requests to the admin app. app = FastAPI()
admin = Admin(app, engine)
admin.admin.parent = app Now in your request you can access the state like this request.app.parent.state |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
aminalaee
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also had this issue, I had to attach the FastAPI app to the admin app to be able to access it in requests to the admin app.
Now in your request you can access the state like this