Some parts are most definitely not Django 1.5 compatible yet: https://bitbucket.org/ubernostrum/django-registration/src/8f242e35ef7c004e035e54b4bb093c32bf77c29f/registration/forms.py?at=default#cl-48
class RegistrationForm(forms.Form):
# ...
def clean_username(self):
# ...
# The line below needs fixing
existing = User.objects.filter(username__iexact=self.cleaned_data['username'])
if existing.exists():
raise forms.ValidationError(_("A user with that username already exists."))
else:
return self.cleaned_data['username']
So unless those methods are changed and/or you subclass them, it won't work yet.
For your specific case this registration form should do the trick:
from registration import forms as registration_forms
from django.contrib import auth
class RegistrationForm(registration_forms.RegistrationForm):
def clean_username(self):
'''
Validate that the username is alphanumeric and is not already
in use.
'''
User = auth.get_user_model()
existing = User.objects.filter(display_name__iexact=self.cleaned_data['username'])
if existing.exists():
raise forms.ValidationError(_("A user with that name already exists."))
else:
return self.cleaned_data['username']
In addition to a custom property on your model:
class MyUser(AbstractBaseUser, PermissionsMixin):
# ...
def get_username(self):
return self.display_name
def set_username(self, username):
self.display_name = username
def del_username(self):
del self.display_name
username = property(get_username, set_username, del_username)