Skip to content

Commit

Permalink
Update DJANGO.md
Browse files Browse the repository at this point in the history
  • Loading branch information
countable authored Sep 26, 2024
1 parent 8a14623 commit 69d83e8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions developers/DJANGO.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ For example, `urls.py` should really only import from `views.py` (and `utils.py`
- You should usually avoid DateField, and it's better to store DateTimeField because then we can switch timezones later on if needed. (Most events do have time at which they occurred, and that should be stored.)
- Store Datetimes in the database in UTC.
- Only convert to a specific timezone at the View/Template layer (when rendering or collectin information from the user).
- Note Python has several timezone libraries that can sometimes [conflict or have performance issues](https://blog.ganssle.io/articles/2018/03/pytz-fastest-footgun.html). The fast and correct way to set a timezone of a datetime object is `dt_object.replace(tzinfo=ZoneInfo("America/Pacific"))` .

### Managing Environments

Expand Down

0 comments on commit 69d83e8

Please sign in to comment.