[Django]-Anyone knows a good hack to make django-registration use emails as usernames?

6👍

We used django-registration with a custom backend, where we overwrote (or defined) the clean method of the registration form:

def clean(self):
    ...
    # use the email as the username 
    if 'email' in self.cleaned_data:
        self.cleaned_data['username'] = self.cleaned_data['email']

There are other ways:

Note that by default, usernames can be only 30 chars long. You’ll need a hack for that, too:

👤miku

0👍

Since Django 1.5 now it possible to have custom auth.User and make email address as username.

Leave a comment