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

def clean(self, value):

    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
