How can I generate a query_set through a related model?
For example, how can I do this:
UserProfile.objects.filter(user.is_active=True) # Can't use user.is_active to filter
Trivial question, trivial answer. But I'll keep it here for posterity's sake.
This is well documented in the Django docs.
The easiest way to follow a relationship is to use a simple "__".
UserProfile.objects.filter(user__is_active=True)
These can be changed together as well (ie user_parent_email='abc@def.com')
From the Django documention
In your example this would be: