On Thu, Feb 21, 2008 at 5:06 PM, Albert Hopkins <[EMAIL PROTECTED]> wrote: > I have a model with a M2M field and I want to filter based on the field > being empty. How do I do this? I tried > MyModel.objects.filter(m2mfield=[]) but that raises a (MySQL) exception.
Is this what you want? MyModel.objects.filter(m2mfield__pk__isnull=True) Brett --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

