On Sep 17, 8:21 am, Milan Andric <[email protected]> wrote:
> So is there a way I can query on Alumni.objects.filter(**query_params)
> but then return the Profile objects related to the Alumni objects
> rather than the Alumni objects?

>>> query_params = {'grad_year': 2008, 'third_year': True}
>>> profile_qp = dict(('alumni__' + key, val) for key, val in 
>>> query_params.items())
>>> profile_qp
{'alumni__grad_year': 2008, 'alumni__third_year': True}
>>> Profile.objects.filter(**profile_qp)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to