Filip Wasilewski schrieb: > On 2 Gru, 16:45, Thomas Guettler <[EMAIL PROTECTED]> wrote: > >> Hi, >> >> I want to get all objects where the corresponding many-to-many field is >> empty. >> >> Example: get all users without a group >> > [...] > > The preferred solution is using the `isnull` filter: > > User.objects.filter(groups__isnull=True) > > It evaluates to a left join of the `auth_user` table with > `auth_user_groups` and a simple `where` statement. > > Thank you! Django ORM is great.
Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---