Thanks for the snippet Michael, it is quite useful. Now hopefully my
users won't risk to register with an already-existing email address.

However, as you said, I'd like something a bit more consistent so to
avoid bad surprises. Forking the contrib.auth is quite tempting, but
I've had bad experiences with that kind of practice in the past (I
used a patch for contrib.auth that implemented newforms instead of
oldforms, but I later realised it was buggy and had to revert to the
original version).

In fact, I'd prefer to leave what comes with Django, including contrib
apps, untouched. So that I can benefit from bug fixing and
implementation of new features done by the community.

How about hijacking the User EmailField definition with Python
setattr? Would that be possible/safe and how?

Cheers!

Julien

On Apr 7, 1:28 am, Michael <[EMAIL PROTECTED]> wrote:
> I have this style of e-mail usernames for my sites and where it might be not
> as tight as possible, I have an implementation that works.
>
> > 1) Make sure that emails are unique. According to the thread [1]
> > there's no straight forward solution other than patching Django, and I
> > hate patching Django. But maybe since that thread there's been new
> > features allowing to do that without patch?
>
> >http://groups.google.com/group/django-users/browse_thread/thread/8712...
>
> In an environment that has users register on the site, django-registration
> offers a form that checks for uniqueness of the email address. This works
> well as it stops users from registering with duplicate email addresses. The
> key next is to make sure no one who has access to add more users directly
> doesn't add someone with the same e-mail address.
>
> If this is important for you what I would recommend is pulling contrib.auth
> out of the django package into your project and customize it. Contrib apps
> are just that, apps. Just make sure all your settings.py paths point to the
> new one. You can add a few lines of code to the add_view of auth straight
> from django-registration to make sure e-mail is unique. Once you do that you
> should have unique e-mails all around and you didn't need to touch the
> django package, just use a chunk of code.
>
>
>
> > <http://groups.google.com/group/django-users/browse_thread/thread/8712...>
>
> > 2) Generate usernames automatically, since they're not really used
> > anymore but can't stay blank. For example, automatically setting a new
> > user name to "user_8371" if 8371 is the user id. How could I do that,
> > since the User class is built in Django?
>
> I extended a django-registration class to accomplish this. I just put it up
> on djangosnippets.org. Check it outhttp://www.djangosnippets.org/snippets/686/
>
> Hope that helps,
>
> Michael
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to