-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Description
In model AccountTransaction as creation_timestamp we using fernet_fields.EncryptedDateTimeField. And we just found that this field is loosing timezone on save action.
Please see below code:
In [22]: at_z3 = AccountTransaction.objects.last()
In [22]: at_z3.creation_timestamp
Out[22]: datetime.datetime(2021, 10, 29, 3, 16, 6, 896068)
In [23]: at_z3.creation_timestamp = set_timezone(at_z3.creation_timestamp)
In [24]: at_z3.creation_timestamp
Out[24]: datetime.datetime(2021, 10, 29, 3, 16, 6, 896068, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>)
In [25]: at_z3.save()
In [26]: at_z4 = AccountTransaction.objects.last()
In [27]: at_z3
Out[27]: <AccountTransaction: f2d60076-ff91-4d98-8f63-7b2e896635e6-T613951385360465921.48974>
In [28]: at_z4
Out[28]: <AccountTransaction: f2d60076-ff91-4d98-8f63-7b2e896635e6-T613951385360465921.48974>
In [29]: at_z3.creation_timestamp
Out[29]: datetime.datetime(2021, 10, 29, 3, 16, 6, 896068, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>)
In [30]: at_z4.creation_timestamp
Out[30]: datetime.datetime(2021, 10, 29, 1, 16, 6, 896068)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels