Skip to content

Add UNAUTHENTICATED_USER = None note #5679

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged

Conversation

carltongibson
Copy link
Collaborator

When removing authentication entirely you cannot import django.contrib.auth.models.AnonymousUser

Closes #3494

Adds a note to the UNAUTHENTICATED_USER setting docs saying to set to None.

  • Deprecation warning for APIs that do not use auth #3494 has been sat there forever. It's never going to be addressed directly, so beyond this I don't see what we can do.
  • I think removing django.contrib.auth is sufficiently beyond the core case that we can expect users to have discovered this (or do so with a quick search).

When removing authentication entirely you cannot import `django.contrib.auth.models.AnonymousUser`

Closes encode#3494
@carltongibson carltongibson added this to the v3.7.4 milestone Dec 19, 2017
Copy link
Collaborator

@xordoquy xordoquy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could probably get around this by changing this line with:

'UNAUTHENTICATED_USER': 'django.contrib.auth.models.AnonymousUser' if 'django.contrib.auth' in settings.INSTALLED_APPS,

also should include a check on django.contrib.auth.apps.AuthConfig

@carltongibson
Copy link
Collaborator Author

@xordoquy Good point. It'd be good to see this bulletproofed.

I don't see the ROI on testing it thoroughly myself though: it's been two years with no PR, so it can't be hurting too-many people. 🙂

To the future: Happy to see a PR improving this!

@carltongibson carltongibson merged commit cc25f57 into encode:master Dec 19, 2017
@carltongibson carltongibson deleted the 374/removing-contrib-auth-note branch March 3, 2019 19:19
pchiquet pushed a commit to pchiquet/django-rest-framework that referenced this pull request Nov 17, 2020
When removing authentication entirely you cannot import `django.contrib.auth.models.AnonymousUser`

Closes encode#3494
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants