#30012 closed New feature (duplicate)

Ability to specify a custom AnonymousUser

Reported by: Sanket Saurav Owned by: nobody
Component: contrib.auth Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently, it isn't possible to tell Django auth to use a custom AnonymousUser. https://github.com/django/django/blob/master/django/contrib/auth/__init__.py#L179

There is a case in favour of the need for this: if an application uses a custom user model, there can be additional properties and methods added to it, and it makes sense for the AnonymousUser to be able to mirror those properties (even if they are falsey). For the sake of coherence, I believe it makes sense to have the ability to specify a custom AnonymousUser class, just as the AbstractUser.

Change History (2)

comment:1 Changed 20 months ago by Simon Charette

Triage Stage: UnreviewedAccepted

That makes sense to me.

Did you have any implementation in mind? I was thinking a class attribute on AbstractUser could do?

comment:2 Changed 20 months ago by Simon Charette

Resolution: duplicate
Status: newclosed

Actually this is a duplicate of #20313.

Note: See TracTickets for help on using tickets.
Back to Top