+1 for the mixin approach. I needed to copy 90% of the AbstractUser model
just to make the email field unique and remove the username field. The
permission requirements I usually have are compatible with the one's used
by the admin, but the username field is superfluous. As soon as your
permission requirements differ, as Florian describes, you have to roll our
own of course.

If mixins aren't the way to go, it would be nice to have an abstract class
in between AbstractBaseUser and AbstractUser, that contains everything that
is necessary for the admin (AbstractBaseUserAdmin?), with the notion that
you have to add the USERNAME_FIELD yourself.

Regards,

Tino

On Wed, Nov 7, 2012 at 10:04 AM, Florian Apolloner <[email protected]>wrote:

> Hi Alex,
>
>
> On Tuesday, November 6, 2012 11:55:39 PM UTC+1, Alex Ogier wrote:
>>
>> So, I went ahead and implemented the most useful mixin of the three that
>> I defined previously, the PermissionsMixin.
>>
>
> I am not really sold on the idea of having this PermissionMixin, for one
> reason: If I need a custom user model I usually (from my experience, ymmv)
> have different permission requirements either way and don't want stuff like
> is_superuser or is_active. So having those two fields on the mixin class
> makes it unuseable for me again. What I could live with is probably a
> simple PermissionMixin which just provides the dispatching to
> _user_has_perm etc. without checking is_superuser or is_active (If you ask
> me those checks should move to the backend anyways but that's probably not
> that easy due to backwards compat).
>
> Regards,
> Florian
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-developers/-/fKKJ7R4tyMUJ.
>
> 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.
>

-- 
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.

Reply via email to