No inspection available with m2o while creation #441
Unanswered
anna-osipchyk
asked this question in
Q&A
Replies: 1 comment 3 replies
-
Hello @anna-osipchyk Can you share a very minimal example of your model? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello! I have a problem with no inspection error. I have a model User that has role_id as fk to Role model. When i create new user and all data is valid (form is valid), sqladmin just generates new instance and returns RedirectResponsem that's great. But when my form is not valid, then create.html is generated. but it need's to inspect this fk, and as far as it's just "str", not Role instance, it trhows this error:
sqlalchemy.exc.NoInspectionAvailable: No inspection system is available for object of type <class 'str'>.
I tried sending requests with AsyncClient
role = await t.AsyncRoleFactory(name="user") //just instanse of Role model
data={
"username": "[email protected]",
"created_at": (datetime.datetime.now() - datetime.timedelta(days=14)).strftime("%Y-%m-%d %H:%M:%S"),
"role": role,
},
and it worked great. Please, share your thoughts, thank you!
Beta Was this translation helpful? Give feedback.
All reactions