Fixed crash when setting interview for a new candidate

This commit is contained in:
Claude Paroz 2020-02-14 16:32:19 +01:00
parent 887072ba31
commit b1599fbba2

View file

@ -26,6 +26,8 @@ class CandidateForm(forms.ModelForm):
self.initial['interview'].candidat = None
self.initial['interview'].save()
else:
if not obj.pk:
obj.save()
Interview.objects.filter(candidat=obj).update(candidat=None)
self.cleaned_data['interview'].candidat = obj
self.cleaned_data['interview'].save()