Skip to content
Snippets Groups Projects
Commit 89e744a4 authored by Dan Braghis's avatar Dan Braghis
Browse files

Import dates with timezone

parent de3c88a5
No related branches found
No related tags found
No related merge requests found
import argparse import argparse
import json import json
from datetime import datetime from datetime import datetime, timezone
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
...@@ -252,7 +252,7 @@ class Command(BaseCommand): ...@@ -252,7 +252,7 @@ class Command(BaseCommand):
submission = ApplicationSubmission(drupal_id=node['nid']) submission = ApplicationSubmission(drupal_id=node['nid'])
# TODO timezone? # TODO timezone?
submission.submit_time = datetime.utcfromtimestamp(int(node['created'])) submission.submit_time = datetime.fromtimestamp(int(node['created']), timezone.utc)
submission.user = self.get_user(node['uid']) submission.user = self.get_user(node['uid'])
submission.page = FUND submission.page = FUND
...@@ -271,6 +271,7 @@ class Command(BaseCommand): ...@@ -271,6 +271,7 @@ class Command(BaseCommand):
try: try:
submission.save() submission.save()
self.stdout.write(f"Processed \"{node['title']}\" ({node['nid']})")
except IntegrityError: except IntegrityError:
pass pass
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment