>
> * If settings.USER_MODEL is not defined, nothing changes. Otherwise:
>
> * Alternative user model is specified with USER_MODEL =
> 'myapp.models.MyUser'[1] in settings.py.
Django "standard" is myapp.MyUser (as in AUTH_PROFILE_MODULE setting).
>
> * Anything in Django itself that uses the User model can look this up,
> but for backwards compatibility with apps,
> django.contrib.auth.models.User should be a reference to this.
>
> * The user model should physically live in (in terms of app_label,
> position in the admin interface and database prefix) the app it is
> defined in. Does that break anything?
>
> * In the spirit of duck typing, the user model need only contain those
> attributes that are needed in the application.
>
> * There are a lot of utility methods in the existing User class. Does
> that mean that instead of inheriting from just models.Model, the
> alternative user class should also inherit from auth.UserMixin or
> something?
Yes, some kind of BaseUser with Meta: abstract set to True which User
inherits from?
David
It's used in get_storage_class:
http://code.djangoproject.com/browser/django/trunk/django/core/files/storage.py#L215
James wrote about that:
The reason is that Django is not using this to do a direct import;
instead, it’s using an internal model-loading function which only
wants the name of the app and the name of the model.
http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-model/
I'm not sure of the actual good practice for that.
Le 15 sept. 08 à 19:32, Carl Meyer a écrit :
>
> Seems like similar ground is being covered in #3011 [1]
You're right! It needs to be updated but that's it. Any thoughts from
core devs?
David
I'm not following most of this discussion, but I should step in here.
get_storage_class expects a true Python import path, not the
app_label/model_name combination used for loading models. That puts
DEFAULT_FILE_STORAGE on even footing with MIDDLEWARE_CLASSES (where
the code was copied from, to be honest).
-Gul