3👍
✅
Something in “other directions” should work, so it would be e.g.:
SecondChild.objects.filter(first_child__parent=some_parent)
-1👍
You can always use filter
rather than using child_set
. Try to filter on the Model with the foreign key
attribute.
- [Answered ]-Django 1.7 'list_filter' raise AppRegistryNotReady("Models aren't loaded yet.")
- [Answered ]-Django foreign key saving with file name not object
- [Answered ]-Rest framework how to create optional nested object?
- [Answered ]-How can I find the file that's causing a Django error? Getting "Invalid filter: 'add_class'" but no file
Source:stackexchange.com