def q(self): if self.operator == 'eq': return me.Q(**{self.field: self.value}) return me.Q(**{'%s__%s' % (self.field, self.operator): self.value})