Closed gilpinheiro closed 1 year ago
Approximating the code for simplicity. Python 3.9.5 running in production
class V(models.Model): timezone = TimeZoneField( choices=[(tz, tz) for tz in pytz.all_timezones], default="America/Toronto" )
>>> v = V.objects.get(id=1) >>> v.timezone zoneinfo.ZoneInfo(key='America/Toronto')
v.timezone is a ZoneInfo object
And with explicit default set:
class V(models.Model): timezone = TimeZoneField( choices=[(tz, tz) for tz in pytz.all_timezones], default="America/Toronto", use_pytz=True )
>>> v = V.objects.get(id=1) >>> v.timezone <DstTzInfo 'America/Toronto' LMT-1 day, 18:42:00 STD>
which is indeed a pytz object.
contradicting the documented default, (Django <= 3.X: use_pytz defaults to True)
I haven't had a chance to dig deeper, but I thought I'd report early.
Thank for the bug report. I think this is a duplicate of #109, which should be fixed in the release I just pushed to pypi - v6.0.1. Please give it a try and re-open this if it doesn't work for you.
v6.0.1
Approximating the code for simplicity. Python 3.9.5 running in production
v.timezone is a ZoneInfo object
And with explicit default set:
which is indeed a pytz object.
contradicting the documented default, (Django <= 3.X: use_pytz defaults to True)
I haven't had a chance to dig deeper, but I thought I'd report early.