On 15 syys, 18:59, Anssi Kääriäinen <[email protected]> wrote:
> With the above commits I can do this:
>
> class MyUser(AbstractUser):
> employee_no = models.CharField(max_length=5)
> some_other_field = models.TextField(null=True, blank=True)
> REQUIRED_FIELDS = AbstractUser.REQUIRED_FIELDS + ['employee_no']
>
> syncb & create_superuser commands work. Admin doesn't work directly,
> but it seems you can easily subclass the default user admin & change
> form to make it work.
>
> Single-table inheritance seems useful to me, and the added complexity
> to code isn't much.
Actually, there is more common use case which doesn't seem to be
solved by the current branch: getting proxy instances into
request.user. If you use just ProxyUser(auth.User) the proxy model
will not be loaded into request.user, and if you set the ProxyUser as
AUTH_USER_MODEL, then it will not work as you can't subclass the
swapped out auth.User.
The added commits solves this by allowing you to do:
class MyUser(AbstractUser):
# define additional methods etc.
and:
settings.AUTH_USER_MODEL = 'myuser'
This could also be solved by somehow allowing fetching proxy instance
to request.user. In any case, IMO this needs some solution before
release.
This feature is already looking really good. I know that every single
one of my projects will have uses for this feature, so I am really
looking forward to getting this into 1.5.
- Anssi
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en.