Saturday, August 31, 2013

Re: Form validation number and text only no space mac 4 numbers

that still allows space,weird chars and more then 4 numbers

input: 

dfdfdf565665&^^^


got saved



    def clean_profielnaam(self):
        data = self.cleaned_data['profielnaam']
        if not re.match(r'^[a-zA-Z0-9]{1,4}', data):
            raise forms.ValidationError("Je mag alleen tekst en cijfers gebruiken en geen spaties")

        return data

--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment