forked from github/plane
chore: created by key changed (#4389)
This commit is contained in:
parent
a40517015b
commit
d946c51ef1
@ -447,7 +447,7 @@ class IssueViewSet(BaseViewSet):
|
|||||||
)
|
)
|
||||||
datetime_fields = ["created_at", "updated_at"]
|
datetime_fields = ["created_at", "updated_at"]
|
||||||
issues = user_timezone_converter(
|
issues = user_timezone_converter(
|
||||||
issue_queryset, datetime_fields, request.user.user_timezone
|
issues, datetime_fields, request.user.user_timezone
|
||||||
)
|
)
|
||||||
return Response(issues, status=status.HTTP_200_OK)
|
return Response(issues, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
|
@ -8,14 +8,14 @@ def user_timezone_converter(queryset, datetime_fields, user_timezone):
|
|||||||
if isinstance(queryset, dict):
|
if isinstance(queryset, dict):
|
||||||
queryset_values = [queryset]
|
queryset_values = [queryset]
|
||||||
else:
|
else:
|
||||||
queryset_values = list(queryset.values())
|
queryset_values = list(queryset)
|
||||||
|
|
||||||
# Iterate over the dictionaries in the list
|
# Iterate over the dictionaries in the list
|
||||||
for item in queryset_values:
|
for item in queryset_values:
|
||||||
# Iterate over the datetime fields
|
# Iterate over the datetime fields
|
||||||
for field in datetime_fields:
|
for field in datetime_fields:
|
||||||
# Convert the datetime field to the user's timezone
|
# Convert the datetime field to the user's timezone
|
||||||
if item[field]:
|
if field in item and item[field]:
|
||||||
item[field] = item[field].astimezone(user_tz)
|
item[field] = item[field].astimezone(user_tz)
|
||||||
|
|
||||||
# If queryset was a single item, return a single item
|
# If queryset was a single item, return a single item
|
||||||
|
Loading…
Reference in New Issue
Block a user