-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
One-to-many relations #220
Comments
Hi @McSlow If you just just want to find the bands for a single manager, you can do something like: manager = Manager.objects().get(Manager.name == 'Guido').run_sync()
>>> Band.objects().where(Band.manager == manager).run_sync()
[<Band: 1>] There isn't an API yet to bulk retrieve all of the bands for all of the managers (i.e. reverse foreign key lookups), but it's something we're working on. If that's your use case, you might find this discussion useful: #208 |
Thanks- that was fast :) |
The best way to see how it all hangs together with FastAPI, is use |
Ah ok- that was really easy, got it. Thanks again :) |
Any news on this? |
Hi,
i'm currently having some beginner issues with one-to-many relations. Given the following scheme:
How can I access all Bands a Manager manages?
So something like
bandsAManagerManages = Manager.bands
Is there some automatic support for such things or do I need to write a function with a subquery in the Manager table (... .where(manager=self.id)?
The text was updated successfully, but these errors were encountered: