You can do

Users.objects.exclude(project__owner__isnull=True,
                             other__model__isnull=True).distinct()

~Jakob

On Jun 9, 7:49 pm, Streamweaver <streamwea...@gmail.com> wrote:
> I have two models with Foreign Key relationships to Users and what I'm
> looking to do is reterive a unique list of users from both Models.
>
> class Project(models.Model):
>     owner = models.ForeignKey(User)
>
> class Release(models.Model):
>     owner = models.ForeignKey(User)
>
> I know I can retrieve a distinct list of users from either by spanning
> relationships. (using Projects as an example)
>
> Users.objects.filter(project__owner__isnull=False).distinct()
>
> But how would I get a distinct set of Users who are owners of Projects
> OR Releases?
>
> Thanks for any insight.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to