After some time, I got IT... Thanks for your response.
Hre is the solution I got, and yeah - it a Python problem (regular
expression)
from django import forms
from django.forms.util import ErrorList
import re
class ExtraRegForm(forms.Form):
username=forms.CharField(min_length=4, max_length=16)
def clean(self):
cleaned_data=self.cleaned_data
username=cleaned_data.get("username")
pattern='(__)|(\w*)(_)(\w*)(_)(\w*)(_)(\w*)'
u_name=re.search(pattern, username)
if u_name:
msg="No consecutive underscores and no more than 3
underscores"
self._error["username"]=ErrorList(msg)
return cleaned_data
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---