From: bobcall Date: Thu, 10 Jan 2013 20:46:09 +0000 (-0500) Subject: added instructor_name / email to dj_to_world_json.py X-Git-Tag: release-20150131~569^2 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c82eb97494f6163e3bf3518c47fc8f48eb11ddc6;p=oweals%2Fkarmaworld.git added instructor_name / email to dj_to_world_json.py --- diff --git a/bin/dj_to_world_json.py b/bin/dj_to_world_json.py index fc2d733..2bc803e 100644 --- a/bin/dj_to_world_json.py +++ b/bin/dj_to_world_json.py @@ -23,13 +23,19 @@ def course_to_dict(course): course_dict['name'] = c_dict['title'] course_dict['slug'] = c_dict['slug'] course_dict['school_id'] = c_dict['school_id'] -# course_dict['file_count'] course_dict['desc'] = c_dict['desc'] course_dict['url'] = c_dict['url'] course_dict['academic_year'] = c_dict['academic_year'] -# course_dict['instructor_name'] + try: + course_dict['instructor_name'] = course.instructor.name + except AttributeError: + course_dict['instructor_name'] = '' + try: + course_dict['instructor_email'] = course.instructor.email + except AttributeError: + course_dict['instructor_email'] = '' # course_dict['instructor_email'] - course_dict['updated_at'] = c_dict['last_updated'] + course_dict['updated_at'] = str(c_dict['last_updated']) course_dict['id'] = c_dict['id'] return course_dict @@ -42,7 +48,7 @@ def note_to_dict(note): notes_dict['tags'] = [tag.name for tag in note.tags.all()] notes_dict['name'] = n_dict['title'] notes_dict['desc'] = n_dict['description'] - notes_dict['uploaded_at'] = n_dict['timestamp'] + notes_dict['uploaded_at'] = str(n_dict['timestamp']) # notes_dict['file_type'] # notes_dict['note_file'] notes_dict['embed_url'] = n_dict['embed_url']