Skip to content

Commit ad5c2dd

Browse files
committed
Add new nominations to the primary address of existing merged nominations.
Allow to enter a secondary address in the primary address of the merge form and the merge is done into the primary address of the secondary address (tongue-twister). Fixes ietf-tools#1034 - Legacy-Id: 5714
1 parent 3cbdecd commit ad5c2dd

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ietf/nomcom/forms.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def __init__(self, *args, **kwargs):
319319

320320
def clean_primary_email(self):
321321
email = self.cleaned_data['primary_email']
322-
nominees = Nominee.objects.get_by_nomcom(self.nomcom).not_duplicated().filter(email__address=email)
322+
nominees = Nominee.objects.get_by_nomcom(self.nomcom).filter(email__address=email)
323323
if not nominees:
324324
msg = "Does not exist a nomiee with this email"
325325
self._errors["primary_email"] = self.error_class([msg])
@@ -352,6 +352,8 @@ def save(self):
352352
secondary_emails = get_list(self.cleaned_data.get("secondary_emails"))
353353

354354
primary_nominee = Nominee.objects.get_by_nomcom(self.nomcom).get(email__address=primary_email)
355+
while primary_nominee.duplicated:
356+
primary_nominee = primary_nominee.duplicated
355357
secondary_nominees = Nominee.objects.get_by_nomcom(self.nomcom).filter(email__address__in=secondary_emails)
356358
for nominee in secondary_nominees:
357359
# move nominations
@@ -451,6 +453,8 @@ def save(self, commit=True):
451453

452454
# Add the nomination for a particular position
453455
nominee, created = Nominee.objects.get_or_create(email=email, nomcom=self.nomcom)
456+
while nominee.duplicated:
457+
nominee = nominee.duplicated
454458
nominee_position, nominee_position_created = NomineePosition.objects.get_or_create(position=position, nominee=nominee)
455459

456460
# Complete nomination data

0 commit comments

Comments
 (0)