From d20464628704a56b0071fc45c36dc61bc41d909f Mon Sep 17 00:00:00 2001 From: Bryan Date: Thu, 9 Jan 2014 01:19:01 -0500 Subject: [PATCH] fixing courses to be more properly unique when importing ocw data. --- .../apps/notes/management/commands/import_ocw_json.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/karmaworld/apps/notes/management/commands/import_ocw_json.py b/karmaworld/apps/notes/management/commands/import_ocw_json.py index 323be16..9365902 100644 --- a/karmaworld/apps/notes/management/commands/import_ocw_json.py +++ b/karmaworld/apps/notes/management/commands/import_ocw_json.py @@ -94,12 +94,13 @@ class Command(BaseCommand): # Extract the course info course_info = { 'name': course['courseTitle'], - 'instructor_name': course['professor'], - 'school': dbschool, + 'department': dbdept, } # Create or Find the Course object. dbcourse = Course.objects.get_or_create(**course_info)[0] dbcourse.professor = dbprof + dbcourse.instructor_name = course['professor'] + dbcourse.school = dbschool dbcourse.save() print "Course is in the database: {0}".format(dbcourse.name) @@ -165,7 +166,7 @@ class Command(BaseCommand): # Do tags separately dbnote.tags.add('mit-ocw','karma') - print "Sending to GDrive and saving note to database." + print "Converting document and saving note to database." try: convert_raw_document(dbnote) except ValueError, e: -- 2.25.1