chore: created by key changed (#4389)

This commit is contained in:
Bavisetti Narayan 2024-05-07 19:22:00 +05:30 committed by GitHub
parent a40517015b
commit d946c51ef1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -8,14 +8,14 @@ def user_timezone_converter(queryset, datetime_fields, user_timezone):
if isinstance(queryset, dict):
queryset_values = [queryset]
else:
queryset_values = list(queryset.values())
queryset_values = list(queryset)
# Iterate over the dictionaries in the list
for item in queryset_values:
# Iterate over the datetime fields
for field in datetime_fields:
# 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)
# If queryset was a single item, return a single item