Description
MDN URL
https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Authentication
What specific section or headline is this issue about?
Logout template
What information was incorrect, unhelpful, or incomplete?
It appears that there is an unexpected behaviour in the logout process. If logged in as a Superuser, the "Logout" link in the sidebar (in "base_generic.html") works as expected. The url shown on logout is: http://localhost:8000/admin/logout/
However, for users with no "Staff status" or "Superuser status", on clicking the same "Logout" link in the sidebar, the system throws a "Django administration" authentication/authorization error and displays the Admin login. The user remains logged in and the URL displayed is http://localhost:8000/admin/login/?next=/admin/
What did you expect to see?
My expectation is that the logout link's behaviour is the same for all users and takes users to the Login page created (login.html) as per the notes in the section rather than trying to redirect users with no Admin access to the Admin section. (...scratching my head for hours on this one...).
Do you have any supporting links, references, or citations?
I followed the advice on https://stackoverflow.com/questions/15467831/django-logout-redirects-me-to-administration-page
...making sure that my app comes before django.contrib.admin under installed apps in settings.py. This didn't resolve my issue.
Do you have anything more you want to share?
I have confirmed that my code is identical to the tutorial to the best of my ability. However, being somewhat human, I may have made an error somewhere! If so, I apologise in advance.
MDN metadata
Page report details
- Folder:
en-us/learn/server-side/django/authentication
- MDN URL: https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Authentication
- GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/learn/server-side/django/authentication/index.md
- Last commit: 1f983d0
- Document last modified: 2024-03-18T02:28:15.000Z