views:

197

answers:

2

I don't like models.User, but I like Admin view, and I will keep admin view in my application.

How to overwirte models.User ? Make it just look like following:

from django.contrib.auth.models import User

class ShugeUser(User) 
    username = EmailField(uniqute=True, verbose_name='EMail as your 
username', ...) 
    email = CharField(verbose_name='Nickname, ...) 

User = ShugeUser
+4  A: 

That isn't possible right now. If all you want is to use the email address as the username, you could write a custom auth backend that checks if the email/password combination is correct instead of the username/password combination (here's an example from djangosnippets.org).

If you want more, you'll have to hack up Django pretty badly, or wait until Django better supports subclassing of the User model (according to this conversation on the django-users mailing list, it could happen as soon as Django 1.2, but don't count on it).

piquadrat
A: 

The answer above is good and we use it on several sites successfully. I want to also point out though that many times people want to change the User model they are adding more information fields. This can be accommodated with the built in user profile support in the the contrib admin module.

You access the profile by utilizing the get_profile() method of a User object.

Related documentation is available here.

wlashell