1👍
Actually, this should do it:
B.objects.filter(a=mya, c__b__isnull=False)
or
B.objects.filter(a=mya, c__b=F('id'))
1👍
vals = C.objects.filter(b__a=mya).select_related("b").distinct()
bsiwant = [c.b for c in vals]
Should do it in a single query.
- [Answered ]-How to link django to my own 404 error page?
- [Answered ]-How to route DetailView to inherit user and slug
- [Answered ]-How to Running external command (Django) for overriding files in server?
- [Answered ]-I need advice to integrate an app to my project
Source:stackexchange.com