Just for the record, I have created the following class (subclassing
RegistrationFormUniqueEmail):-

class RegistrationFormNonBlacklisted(RegistrationFormUniqueEmail):
    def clean_username(self):
        if self.cleaned_data['username'] in settings.BLACKLISTED_USERNAMES:
            raise forms.ValidationError(_(u'The username you have
chosen is invalid. Please supply a different username.'))
        return self.cleaned_data['username']

added the following line to my urls.py:-

(r'^accounts/register/$', register, {'form_class':
RegistrationFormNonBlacklisted}),

and added BLACKLISTED_USERNAMES to my settings.py to check against.

Works a treat!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to