I've using django-registration to do that...

class RegistrationFormTOSAndUniqueEmail(RegistrationFormTermsOfService,
RegistrationFormUniqueEmail):
    def __init__(self, *args, **kwargs):
    super(RegistrationFormTOSAndUniqueEmail, self).__init__(*args, **kwargs)

    def clean_email(self):
        self.cleaned_data['username'] = md5(self.cleaned_data['email'] +
str(time.time())).hexdigest()
        return super(RegistrationFormTOSAndUniqueEmail, self).clean_email()

It's little "complicated" because I like to reg with mail and I like to show
the Terms Of Service.

At clean_email I'm creating a hash to save as unique in the username field.

I can help you more if you like, but I did this lot of time ago... it's
complicated :p But django-registration is very good documented

On Fri, Aug 27, 2010 at 18:59, Eric Chamberlain <e...@rf.com> wrote:

>
> On Aug 26, 2010, at 9:31 PM, nobosh wrote:
>
> > Hello, I'm on day 7 learning Django and would appreciate any info
> > around getting my Django app started with a Registration/Authorization
> > which is Email & Password based (not username). I'll don't currently
> > have a need for usernames. Is there an app or a clean/smart way to
> > implement. I'm trying to avoid bad habits as this is my first step
> > after reading the book.
> >
>
> We've done a few apps that use email for auth.  In some cases, we generate
> a random 30-character username, the odds of a collision are very low and we
> don't run into issues trying to truncate an email address so it will conform
> to the username field character and length requirements.  In other cases,
> where we need a deterministic username, we base64 encode a UUID for the
> username.
>
> We try to not tie the username to a derivative of the email address, so we
> can avoid username collisions if the user changes their email address.
>
> Don't forget to add an index to the email field.
>
> --
> Eric Chamberlain, Founder
> RF.com - http://RF.com/
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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