def test_exclude(self):
    apple = self.food_model.objects.create(name='apple')
    apple.tags.add('red', 'green', 'delicious')
    pear = self.food_model.objects.create(name='pear')
    pear.tags.add('green', 'delicious')
    self.food_model.objects.create(name='guava')
    pks = self.food_model.objects.exclude(tags__name__in=['red'])
    model_name = self.food_model.__name__
    self.assertQuerysetEqual(pks, ['<{0}: pear>'.format(model_name), '<{0}: guava>'.format(model_name)], ordered=False)
def test_exclude(self):
    apple = self.food_model.objects.create(name='apple')
    apple.tags.add('red', 'green', 'delicious')
    pear = self.food_model.objects.create(name='pear')
    pear.tags.add('green', 'delicious')
    self.food_model.objects.create(name='guava')
    pks = self.food_model.objects.exclude(tags__name__in=['red'])
    model_name = self.food_model.__name__
    self.assertQuerysetEqual(pks, ['<{0}: pear>'.format(model_name), '<{0}: guava>'.format(model_name)], ordered=False)