__init__(self, base): self.base = base def __call__(self, value): if value % self.base != 0: raise ValidationError( _('Field must be a multiple of %(base)d.'), params={'base': self.base, 'value': value}, ) def __eq__(self, other): return ( isinstance(other, self.__class__) and self.base == other.base )