Changes between Initial Version and Version 1 of Ticket #34699, comment 17
- Timestamp:
- Apr 7, 2025, 2:00:33 PM (5 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #34699, comment 17
initial v1 1 1 Without a proper notion of typing / distinct types for Django naive vs aware datetime fields it is quite hard to make the experience better here. The way things are currently designed `DateTimeField` is expected to be naive if `USE_TZ = False` and aware otherwise, there's no way to represent naive `DateTimeField` at the ORM level when `USE_TZ = True`. 2 2 3 Even on Postgres which has distinct types for naive and aware timestamps (`timestamp` and `timestamptz`) there's no warning emitted when mixing both; [https://dbfiddle.uk/xyLSKpNO it simply defaults to the globally configured timezone]. 3 Even on Postgres which has distinct types for naive and aware timestamps (`timestamp` and `timestamptz`) there's no warning emitted when mixing both; [https://dbfiddle.uk/xyLSKpNO it simply defaults to the globally configured timezone] like it's the case on Python 4 5 {{{#!python 6 >>> timezone.now() > datetime.datetime.now() 7 TypeError: can't compare offset-naive and offset-aware datetimes 8 }}} 4 9 5 10 > Personally I feel the code should behave differently, but I don't see clearly how such fix would look or we would handle the potential deprecation/behavior change.