I created my own manager:
class DataManager(models.Manager):
def optfilter(self, options = dict()):
kwargs = dict()
if options.has_key('active'):
kwargs['active__id'] = options['active']
return self.filter(**kwargs)
active is ManyToMany field.
and it working exacly as I want. But what about when I want exclude object from filter?
Something like this:
kwargs['exclude_active_id'] = options['active']
Same idea as you’re already implemented except use exclude instead of filter