From: yomguy Date: Wed, 7 Nov 2012 10:47:46 +0000 (+0100) Subject: auto add new (blank) professor when missing X-Git-Tag: 0.9-probarreau~325 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=f1eb8af618b2157491418a2db71e1ddaeee23501;p=teleforma.git auto add new (blank) professor when missing --- diff --git a/teleforma/views/core.py b/teleforma/views/core.py index 76bebe99..6b58cfbf 100644 --- a/teleforma/views/core.py +++ b/teleforma/views/core.py @@ -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'],