On Fri, Sep 28, 2012 at 2:02 AM, Chris Pagnutti
<chris.pagnutti@gmail.com> wrote:
> Hi. First-time poster here. Feel free to point out any rules I'm not
> following.
>
> I've been looking around for how to make the django.contrib.auth User
> classe's "email" field to be unique and required. There are bunches of ways
> to do it, but it's just soooo darn easy to go into the source and change how
> the field is defined.
> e.g. email = models.EmailField(_('email address'),unique=True)
>
> But in my searches, I've read warnings that you should not do this. The
> reason, if it is given, is that you'll break your app if you update the
> contrib packages. But what if I work in virtualenvs and just leave the
> django version and packages intact for that particular app in that
> particular environment? What are the other practical and philosophical
> reasons for NOT editing the contrib source? Will I be smitten from the
> django community if I do so?
Will this approach work? Yes. Ish. :-)
All you're really proposing is a fork of Django. That approach can
certainly work; the downside is that you have to maintain the fork by
yourself.
The good news - as of 2 days ago, Django's trunk has a way for you to
change the User model in an official manner [1]. These changes will be
in Django 1.5, due for release at the end of the year.
If you need a solution *right now*, there was a thread on django-users
a couple of days ago that discussed almost exactly this problem; a
couple of alternate approaches were suggested [2].
[1] https://docs.djangoproject.com/en/dev/topics/auth/#customizing-the-user-model
[2] https://groups.google.com/d/topic/django-users/bPCCAK8x8ig/discussion
Yours,
Russ Magee %-)
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment