#36018: Sites.objects.get_current() will always return the settings.SITE_ID, even
when the optional request is passed
-------------------------+-----------------------------------------
Reporter: devo-wm | Type: Bug
Status: new | Component: contrib.sites
Version: 5.1 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------+-----------------------------------------
It looks like if you've set the SITE_ID in your settings, the conditional
in get_current() will always return that site id, even if you pass the
optional request.
We thought that perhaps un-setting the SITE_ID would resolve this, but
these seems to counter the steps involved when enabling and configuring
the sites framework:
https://docs.djangoproject.com/en/5.1/ref/contrib/sites/#enabling-the-
sites-framework
The simple fix seems to be switching the order of the conditional in that
method, thereby always checking the optional request parameter first.
--
Ticket URL: <
https://code.djangoproject.com/ticket/36018>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.