make import-all-depts-and-courses code more tolerant of redundant course codes in...
authorgfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Tue, 28 Dec 2010 01:07:53 +0000 (01:07 +0000)
committergfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Tue, 28 Dec 2010 01:07:53 +0000 (01:07 +0000)
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@1124 6d9bc8c9-1ec2-4278-b937-99fde70a366f

conifer/syrup/views/admin.py

index 3ec2fe1..3a1d4b7 100644 (file)
@@ -124,12 +124,13 @@ def admin_update_depts_courses(request):
             'hook %r not found.' % HOOKNAME)
     else:
         for deptname, ccode, cname in catalogue:
+            print (deptname, ccode, cname)
             if not (deptname.strip() and ccode.strip() and cname.strip()):
                 continue
             dept, x = models.Department.objects.get_or_create(
-                name=deptname, service_desk=desk)
+                name=deptname, defaults={'service_desk': desk})
             models.Course.objects.get_or_create(
-                department=dept, name=cname, code=ccode)
+                code=ccode, defaults={'department': dept, 'name': cname})
         return simple_message('Courses and departments updated.', '')
 
 def admin_update_terms(request):