While it is now possible to reuse session backend classes, it's not the
case for the corresponding parts of the test client.
Namely, in case of having the custom session backend and its corresponding
parts (models, middleware, etc) as a separate application, you're unable
to use the test client with sessions. The issue is
`'django.contrib.sessions'` being hardcoded inside of `_session` and
`login()`.
Working that around involves monkey-patching the test client with modified
copies of `_session` and `login()`.
I suggest refactoring test client for better reusability (given this would
eliminate session app name being hardcoded).
--
Ticket URL: <https://code.djangoproject.com/ticket/25699>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* has_patch: 0 => 1
* needs_tests: => 1
* needs_docs: => 0
Comment:
A possible solution in PR https://github.com/django/django/pull/5586
--
Ticket URL: <https://code.djangoproject.com/ticket/25699#comment:1>
* stage: Unreviewed => Accepted
Comment:
I think that this is an useful thing to have.
I'm unsure about your PR on first sight, though, as it needs to add a new
setting for an edge case and adding settings is generally discouraged.
Maybe someone else likes to review it more thouroughly.
--
Ticket URL: <https://code.djangoproject.com/ticket/25699#comment:2>
Comment (by claudep):
Instead of adding a new setting, I'd rather see an AppConfig attribute
(like `session_app`), and then the `_session_app_is_installed` could cycle
through installed AppConfig's to look for this attribute.
--
Ticket URL: <https://code.djangoproject.com/ticket/25699#comment:3>
* owner: nobody => sergeykolosov
* needs_better_patch: 0 => 1
* status: new => assigned
Comment:
Sounds good, I'll update the PR given the suggested approach.
--
Ticket URL: <https://code.djangoproject.com/ticket/25699#comment:4>
* type: Uncategorized => New feature
--
Ticket URL: <https://code.djangoproject.com/ticket/25699#comment:5>
* cc: walt@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/25699#comment:6>
Comment (by sergeykolosov):
I'm gonna work on solution suggested in
https://github.com/django/django/pull/5586#issuecomment-161918171
--
Ticket URL: <https://code.djangoproject.com/ticket/25699#comment:7>
* needs_better_patch: 1 => 0
* needs_tests: 1 => 0
Comment:
A new PR: https://github.com/django/django/pull/6380
--
Ticket URL: <https://code.djangoproject.com/ticket/25699#comment:8>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/25699#comment:9>
Comment (by sergeykolosov):
PR updated: https://github.com/django/django/pull/6380
--
Ticket URL: <https://code.djangoproject.com/ticket/25699#comment:10>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"21dd98a38660747c781802afca7ca02407964383" 21dd98a3]:
{{{
#!CommitTicketReference repository=""
revision="21dd98a38660747c781802afca7ca02407964383"
Fixed #25699 -- Allowed using the test client if 'django.contrib.sessions'
isn't in INSTALLED_APPS.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25699#comment:11>