Opened 6 years ago

Closed 6 years ago

#30012 closed New feature (duplicate)

Ability to specify a custom AnonymousUser

Reported by: Sanket Saurav Owned by: nobody
Component: contrib.auth Version: dev
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 by Simon Charette, 6 years ago

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 by Simon Charette, 6 years ago

Resolution: duplicate
Status: newclosed

Actually this is a duplicate of #20313.

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