From 4e1e6fd428c7b1b080eaf2a090008b59a21f8202 Mon Sep 17 00:00:00 2001 From: gfawcett Date: Tue, 28 Dec 2010 01:07:53 +0000 Subject: [PATCH] make import-all-depts-and-courses code more tolerant of redundant course codes in the imported data. git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@1124 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- conifer/syrup/views/admin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/conifer/syrup/views/admin.py b/conifer/syrup/views/admin.py index 3ec2fe1..3a1d4b7 100644 --- a/conifer/syrup/views/admin.py +++ b/conifer/syrup/views/admin.py @@ -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): -- 2.11.0