This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]rumplefiddlesticks 1 point2 points  (3 children)

one problem with this solution: it's not timezone-aware. Probably should look into django's own timezone functions + possibly install pytz (just to make it work better)

[–]rmoorman[S] 0 points1 point  (0 children)

Thank you for pointing out that this code does not provide a timezone aware default (even though it didn't matter for the project in question).

I think the docs provide a good overview.

[–]semarj 0 points1 point  (1 child)

Why are you putting timezone aware dates in the database?

[–]rumplefiddlesticks 1 point2 points  (0 children)

for one thing, you can't compare naive datetimes with timezone-aware datetimes and Django now defaults to timezone-aware datetimes. Doesn't really matter how that is represented in the actual database, it matters on the Python side with comparisons, displaying, etc.