Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add UNAUTHENTICATED_USER = None note #5679

Merged

Conversation

carltongibson
Copy link
Collaborator

@carltongibson carltongibson commented Dec 19, 2017

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 requested a review from xordoquy Dec 19, 2017
@carltongibson carltongibson added this to the v3.7.4 milestone Dec 19, 2017
Copy link
Collaborator

@xordoquy xordoquy left a comment

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

carltongibson commented Dec 19, 2017

@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
1 check passed
@carltongibson carltongibson deleted the 374/removing-contrib-auth-note branch Mar 3, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants