from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.core.validators import RegexValidator

class UsernameValidator(RegexValidator):
    regex = '^[a-zA-Z0-9_.-]+$'
    message = 'Username can only contains '


def emailUniqueValidator(email):
    if email and User.objects.filter(email=email).count():
        raise ValidationError(u'A user with that email address already exists.')

@@ -208,10 +208,8 @@
 Z0-9
-_.
 -%5D+$
@@ -252,16 +252,32 @@
 ontains 
+a-z, A-Z, -, 0-9
 '%0A%0A%0Adef 

change validator username