8000 fix(dumpscript): `make_aware` should not be called if aware already by blueyed · Pull Request #1745 · django-extensions/django-extensions · GitHub
[go: up one dir, main page]

Skip to content

fix(dumpscript): make_aware should not be called if aware already #1745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion django_extensions/management/commands/dumpscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def orm_item_locator(orm_obj):
v = clean_dict[key]
if v is not None:
if isinstance(v, datetime.datetime):
4E45 v = timezone.make_aware(v)
if not timezone.is_aware(v):
v = timezone.make_aware(v)
clean_dict[key] = StrToCodeChanger('dateutil.parser.parse("%s")' % v.isoformat())
elif not isinstance(v, (str, int, float)):
clean_dict[key] = str("%s" % v)
Expand Down
0