1👍
✅
Just use the double-underscore notation to make lookups that span relationships. In this case, it could be done like this:
transfer_lines = TransferLine.objects.filter(transfer__mobility=mobility,
organism=organism)
1👍
Another approach would be to use the ForeignKey
reverse relation:
tlines = my_organisam.transferline_set.filter(transfer__mobility=my_mobility)
- [Answered ]-Get gmail email using django allAuth
- [Answered ]-Retrieve Django ManyToMany results outside of the current model
Source:stackexchange.com