'Raises a ValidationError if the card is not valid and stashes card type.'

def clean(self, value):

    self.card_type = verify_credit_card(value)
    if (self.card_type is None):
        raise forms.ValidationError('Invalid    credit    card    number.')
    return value
