It seems that 'exclude'ing on a M2M field does not have the effect I anticipated. Am I doing something wrong? Basically I have the following models
========== class Platform(models.Model): name = models.Charfield(..., unique=True) class Release(models.Model): ... platforms = models.ManyToManyField(Platform, related_name='platforms') prev_platforms = models.ManyToManyField(Platform, related_name='prev_platforms') ========== So I do this: ========== $ ./manage.py shell ... In [2]: releases = Release.objects.all() In [3]: releases.count() Out[3]: 25278L In [4]: hppa = releases.filter(platforms__name='hppa') In [5]: hppa.count() Out[5]: 3854L In [6]: # ok, looks good, but In [7]: hppa_new = hppa.exclude(prev_platforms__name='hppa') In [8]: hppa_new.count() Out[8]: 3388L In [9]: # seems a bit high, and In [10]: first = hppa_new[0] In [11]: first.prev_platforms.all() Out[11]: [<Platform: alpha>, <Platform: arm>, <Platform: hppa>, <Platform: ia64>, <Platform: mips>, <Platform: ppc>, <Platform: ppc64>, <Platform: s390>, <Platform: sh>, <Platform: sparc>, <Platform: x86>] ========== Notice the '<Platform: hppa>' even though I thought I excluded it. I know I took a shortcut using 'platforms__name' instead of instantiating the Platform but I get the same result either way. So am I doing something wrong or is there another way of doing this? Thanks, Albert --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---