]> git.parisson.com Git - teleforma.git/commitdiff
auto add new (blank) professor when missing
authoryomguy <yomguy@parisson.com>
Wed, 7 Nov 2012 10:47:46 +0000 (11:47 +0100)
committeryomguy <yomguy@parisson.com>
Wed, 7 Nov 2012 10:47:46 +0000 (11:47 +0100)
teleforma/views/core.py

index 76bebe99765ecb2bd8af28adbc884ca6a95437f9..6b58cfbf12714d8ccdcc4029b0bfab2cb0c28a3e 100644 (file)
@@ -487,6 +487,12 @@ class ConferenceRecordView(FormView):
                     user = User.objects.filter(username=conference['professor_id'])
                     if user:
                         conf.professor = Professor.objects.get(user=user[0])
+                    else:
+                        user = User(username=conference['professor_id'])
+                        user.save()
+                        professor = Professor(user=user)
+                        professor.save()
+                        conf.professor = professor
                 try:
                     organization, c = Organization.objects.get_or_create(name=conference['organization'])
                     conf.room, c = Room.objects.get_or_create(name=conference['room'],