I'm trying to make my own phone number form, and I'm having trouble with 
number validation. 

Since international numbers can use "(40) (30)" I want to check that only 
numbers were entered. I can't seem to make it work though.

def clean_international(self):
        data = self.cleaned_data['international']
        # Take off ()
        dataless = data.strip('() ')
         
        if dataless.isdigit() != True:
            raise ValidationError(_('Invalid number'))
        
        return data

This always raises an error. Any suggestions? Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e0d39759-5c6f-45b3-944a-d8cb3f96faf9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to