def __call__(self, form, field):
        if not self.active:
            return

        super(UniqueCardNumber, self).__call__(form, field)
        try:
            check = BreezeCard.objects.get(_number=encrypt(field.data.strip()))
            if check is not None:
                raise ValidationError(self.card_message)
        except:
            pass
Exemple #2
0
 def __setattr__(self, attr, value):
     if attr == 'document':
         self._document = encrypt(value)
     else:
         super(CardData, self).__setattr__(attr, value)
Exemple #3
0
 def set_number(self, value):
     value = format_numeric_number(value)
     self.last_four = value[-4:]
     self._number = encrypt(value)