diff --git a/ietf/api/views.py b/ietf/api/views.py index e587b37121..73b873f5f3 100644 --- a/ietf/api/views.py +++ b/ietf/api/views.py @@ -210,11 +210,14 @@ def err(code, text): except (NomCom.DoesNotExist, NomCom.MultipleObjectsReturned): nomcom = None if nomcom: - Volunteer.objects.create( + Volunteer.objects.get_or_create( nomcom=nomcom, person=object.person, - affiliation=data['affiliation'], - origin='registration') + defaults={ + "affiliation": data["affiliation"], + "origin": "registration" + } + ) return HttpResponse(response, status=202, content_type='text/plain') else: return HttpResponse(status=405) diff --git a/ietf/nomcom/views.py b/ietf/nomcom/views.py index ce7ca9a82d..7705be5697 100644 --- a/ietf/nomcom/views.py +++ b/ietf/nomcom/views.py @@ -1373,7 +1373,7 @@ def volunteer(request): form = VolunteerForm(person=person, data=request.POST) if form.is_valid(): for nc in form.cleaned_data['nomcoms']: - nc.volunteer_set.create(person=person, affiliation=form.cleaned_data['affiliation']) + nc.volunteer_set.get_or_create(person=person, defaults={"affiliation": form.cleaned_data["affiliation"], "origin":"datatracker"}) return redirect('ietf.ietfauth.views.profile') else: form = VolunteerForm(person=person,initial=dict(nomcoms=can_volunteer, affiliation=suggest_affiliation(person)))