On 02.05.2011, at 19:22, Carl Meyer wrote:

> On 05/02/2011 11:38 AM, Jeremy Dunck wrote:
>> Given a blank slate, what would Auth look like these days?  And can we
>> work towards that?
> 
> Now, why you gotta get all constructive and forward-thinking and stuff? ;-)
> 
> Here's my list of core ideal-contrib.auth desiderata that I keep seeing
> crop up in related threads:
> 
> 1. A specification of the minimal useful interface for a User (perhaps
> in the form of an abstract base model?)
> 
> 2. A way to provide your own User class that extends the minimal spec,
> in a single table (i.e. MTI need not apply).
> 
> 3. A way for reusable apps to access and point foreign keys at the User
> model (solutions that involve magically transporting models into other
> modules need not apply - Django's been there, not going back).

As I've said before in person and on IRC, 2. and 3. will most likely be
possible with the app-loading branch. It introduces a notion of an app
class that would (among other things) allow to override the default auth
app by mimicking its API.

This is done by simply telling the app cache to consider a different app
as the app with the "auth" app label. E.g.:

$ cat myapp/models.py
from django.db import models
from django.contrib.auth.models import BaseUser # abstract base user

class User(BaseUser):
    middle_name = models.TextField()

    class Meta:
        verbose_name = "My user"

$ cat myapp/app.py
from django import apps

class MyAuthApp(apps.App):
    
    class Meta:
        label = 'auth'
        db_prefix = 'auth'

Then, in good tradition of duck typing, we use models.ForeignKey('auth.User')
to point to that custom user class, forcing the app cache to return the
myapp.models.User class.

> 4. A migration path that meets our backwards-compatibility standards.

As far as I understand there is little effort needed to split the User
model in an abstract base class and a concrete implementation that is
similar to the current class. Whether this needs some kind of migration
path is a different story.

Jannis

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to