#37137: Replace raw SQL suggestion in TIME_ZONE docs
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Type:
| Cleanup/optimization
Status: new | Component:
| Documentation
Version: dev | Severity: Normal
Keywords: postgresql, | Triage Stage:
timezone | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Our docs counsel avoiding raw SQL usage where the ORM can do. We have old
advice in the `TIME_ZONE` setting advising to use "raw SQL" when local
time conversions are needed. I think instead we should suggest using a
lightweight `Func` wrapping [
https://www.postgresql.org/docs/current
/functions-datetime.html#FUNCTIONS-DATETIME-
ZONECONVERT:~:text=The%20function-,timezone,-(zone%2C%20timestamp
timezone()] to accomplish the same thing:
[
https://docs.djangoproject.com/en/dev/ref/settings/#:~:text=raw%20SQL
Current text]:
{{{
Consider converting to local time explicitly with ``AT TIME ZONE`` in
raw SQL
queries instead of setting the ``TIME_ZONE`` option.
}}}
--
Ticket URL: <
https://code.djangoproject.com/ticket/37137>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.