Opened 13 months ago

Closed 13 months ago

Last modified 13 months ago

#22934 closed Bug (fixed)

INSTALLED_APPS must contain django.contrib.sessions for TestCase.client.login to work

Reported by: cjerdonek Owned by: nobody
Component: Documentation 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

The documentation says that django.contrib.sessions can be removed from INSTALLED_APPS when using cookie-bases sessions:

https://docs.djangoproject.com/en/dev/topics/http/sessions/#using-cookie-based-sessions

However, following this guidance causes TestCase.client.login() to break:

https://github.com/django/django/blob/50b9313e0a0739dfe1ac699449b66ed3e62add51/django/test/client.py#L562

Change History (5)

comment:1 Changed 13 months ago by timo

  • Component changed from Uncategorized to Documentation
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to Bug

Yep, has been raised in #20863 and #20915, but should be corrected in the meantime.

comment:2 Changed 13 months ago by Tim Graham <timograham@…>

In 3a85aae2eacae836e2a92de77615569883b81932:

Revert "Improve cookie based session backend docs." refs #20418

This reverts commit d9c01da1f8ba3d4e0947fd1d619c8f4a9b013360.

This is poor advice as it breaks the test client login (refs #22934).
We can add a note like this back after refs #22986 is resolved.

comment:3 Changed 13 months ago by timo

  • Resolution set to fixed
  • Status changed from new to closed

I removed the advice of removing django.contrib.sessions from INSTALLED_APPS as a solution to avoid creating the database tables due to the other side effects and filed a new ticket (#22986) for a proper solution.

comment:4 Changed 13 months ago by Tim Graham <timograham@…>

In a3d710a38f1fab5e092cef7a17826674a00e70ea:

[1.7.x] Revert "Improve cookie based session backend docs." refs #20418

This reverts commit d9c01da1f8ba3d4e0947fd1d619c8f4a9b013360.

This is poor advice as it breaks the test client login (refs #22934).
We can add a note like this back after refs #22986 is resolved.

Backport of 3a85aae2ea from master

comment:5 Changed 13 months ago by Tim Graham <timograham@…>

In f3bdb83ba58a696c0696d8a6706d2c44a00da68a:

[1.6.x] Revert "Improve cookie based session backend docs." refs #20418

This reverts commit d9c01da1f8ba3d4e0947fd1d619c8f4a9b013360.

This is poor advice as it breaks the test client login (refs #22934).
We can add a note like this back after refs #22986 is resolved.

Backport of 3a85aae2ea from master

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