Correct timezone data from old portal scrape

This commit is contained in:
Tanner Collin 2020-01-16 09:46:11 +00:00
parent b6573f1d72
commit ec5f17d4d3

View File

@ -62,7 +62,7 @@ SESSION_FIELDS = [
'id', 'id',
# course_id -> course # course_id -> course
# instructor -> old_instructor # instructor -> old_instructor
'datetime', # datetime -> fix timezone
'cost', 'cost',
] ]
@ -173,6 +173,7 @@ for o in old:
new[f] = o.__dict__.get(f, None) new[f] = o.__dict__.get(f, None)
new['course'] = models.Course.objects.get(id=o.course_id) new['course'] = models.Course.objects.get(id=o.course_id)
new['old_instructor'] = o.instructor new['old_instructor'] = o.instructor
new['datetime'] = str(o.datetime).replace('Z', '-07:00')
models.Session.objects.create(**new) models.Session.objects.create(**new)
print('Imported session #{} - {} {}'.format( print('Imported session #{} - {} {}'.format(