Not able to get value of Foreign-key model because of weak proxy
#418
harshithjv
started this conversation in
General
Replies: 1 comment 2 replies
-
In your sample, you do not await any of the calls (that's why you get a coroutine) t1 = await Thing.objects.get_or_create(...)
# (...)
ot1 = await OtherThing.objects.get(id=t1.other_thing.id) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I think my issue is similar to what is described in this issuelink, as I'm not able to get attribute of foreign key:
#118
I get
weakproxy
on foreign-key object (as seen in VS Code debug window):Say, I want to access name of
OtherThing
from the instance ofThing
model. Then I'd try to access it like this:So
t1.other_thing.name
return emptyNone
because I can only access.Also I tried to manually getting value of foreign-key object when :
I just get
coroutine(...)
object and not able to display proper data via jinja templates on fastapi. Evenasyncio.run(...)
gives out coroutine object.How can we access the foreign-key model object seamlessly from parent model?
Beta Was this translation helpful? Give feedback.
All reactions