Select fields from through model #872
Answered
by
collerek
Abdeldjalil-H
asked this question in
Q&A
-
I have three models class UserAddress(Model):
phone: str
class Address(Model):
...
class User(Model):
# ...
addresses = ManyToMany(Address, through=UserAddress) I want to get all user addresses with the phone number for each address. For that I need to fetch the user.addresses.select_related("useraddress") I get the following exception
|
Beta Was this translation helpful? Give feedback.
Answered by
collerek
Oct 9, 2022
Replies: 1 comment
-
It's described in the docs: https://collerek.github.io/ormar/relations/many-to-many/#through-fields |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Abdeldjalil-H
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's described in the docs: https://collerek.github.io/ormar/relations/many-to-many/#through-fields