You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
DjangoRestFramework apply current timezone to the datetime values in serializer fields. Concretely it applies the timezone defined in settings.TIMEZONE to datetimes in serializer payload.
Environment
Describe your environment:
Plateform: Any
Python version: Any
Django version: Any
Lotus version: Any
To Reproduce
However from serializers tests it seems that ArticleSerializer.publish_datetime() has no timezone applied from output serializer, this is because we use a SerializerMethodField for it so we don't have the serializers.DateTimeField behavior.
Expected behavior
All date should behave the same. We can apply the timezone in ArticleSerializer.publish_datetime() but it needs to copy the DRF one, that seem to be conditionned to settings.USE_TZ value.
Additional context
This should be a concern only in API, but view/templatetag code have to be inspected to check if they use something like isoformat() formatting which would transform date object in string, that Django would not be able to apply current timezone.
The text was updated successfully, but these errors were encountered:
It seems only Article publish_datetime serializer field is missing the timezone. There is also Article publish_time but i'm not sure it would need the timezone and maybe it is not useful to have the divided publish date and time in payload ?
Describe the bug
DjangoRestFramework apply current timezone to the datetime values in serializer fields. Concretely it applies the timezone defined in
settings.TIMEZONE
to datetimes in serializer payload.Environment
Describe your environment:
To Reproduce
However from serializers tests it seems that
ArticleSerializer.publish_datetime()
has no timezone applied from output serializer, this is because we use aSerializerMethodField
for it so we don't have theserializers.DateTimeField
behavior.Expected behavior
All date should behave the same. We can apply the timezone in
ArticleSerializer.publish_datetime()
but it needs to copy the DRF one, that seem to be conditionned tosettings.USE_TZ
value.Additional context
This should be a concern only in API, but view/templatetag code have to be inspected to check if they use something like
isoformat()
formatting which would transform date object in string, that Django would not be able to apply current timezone.The text was updated successfully, but these errors were encountered: