コード例 #1
0
ファイル: fields.py プロジェクト: peplin/django-paypal
 def clean(self, value):
     """Raises a ValidationError if the card is not valid and stashes card type."""
     value = super(CreditCardField, self).clean(value)
     self.card_type = verify_credit_card(value)
     if self.card_type is None:
         raise forms.ValidationError("Invalid credit card number.")
     return value
コード例 #2
0
ファイル: fields.py プロジェクト: microfins/django-paypal
 def clean(self, value):
     """Raises a ValidationError if the card is not valid and stashes card type."""
     if value:
         self.card_type = verify_credit_card(value)
         if self.card_type is None:
             raise forms.ValidationError("Invalid credit card number.")
     return value
コード例 #3
0
ファイル: fields.py プロジェクト: fernandoguirao/joinity_old
 def clean(self, value):
     """Raises a ValidationError if the card is not valid and stashes card type."""
     if value:
         value = value.replace('-', '').replace(' ', '')
         self.card_type = verify_credit_card(value)
         if self.card_type is None:
             raise forms.ValidationError("Invalid credit card number.")
     return value
コード例 #4
0
 def clean(self, value):
     """Raises a ValidationError if the card is not valid and stashes card type."""
     value = value or ''
     value = value.replace('-', '').replace(' ', '')
     self.card_type = verify_credit_card(value)
     if self.card_type is None:
         raise forms.ValidationError("Invalid credit card number.")
     return value
コード例 #5
0
    def clean(self, value):
        """
        Raises a ValidationError if the card is not valid.
        Also sets card type!
        
        """
        card_type = verify_credit_card(value)
        if card_type is None:
            raise forms.ValidationError("Invalid credit card number.")

        self.card_type = card_type
        return value
コード例 #6
0
ファイル: fields.py プロジェクト: ckelly/django-paypal
    def clean(self, value):
        """
        Raises if it's an invalid card.
        Also sets the card_type.
        
        """
        card_type = verify_credit_card(value)
        if card_type is None:
            raise forms.ValidationError("Invalid credit card number.")

        self.card_type = card_type
        return value
コード例 #7
0
ファイル: fields.py プロジェクト: alexissmirnov/donomo
    def clean(self, value):
        """
        Raises a ValidationError if the card is not valid.
        Also sets card type!
        
        """
        card_type = verify_credit_card(value)
        if card_type is None:
            raise forms.ValidationError("Invalid credit card number.")

        self.card_type = card_type
        return value