From 8f196b450dee64764276995e90eddb871b177791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20A=2E=20S=C3=A1nchez=20L=C3=B3pez?= Date: Thu, 30 Jun 2011 09:44:40 +0000 Subject: [PATCH] Extend the query that search for allowed to login users. Fixes #681 - Legacy-Id: 3192 --- ietf/wgchairs/forms.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ietf/wgchairs/forms.py b/ietf/wgchairs/forms.py index 7aca1291c..d75f4d2fc 100644 --- a/ietf/wgchairs/forms.py +++ b/ietf/wgchairs/forms.py @@ -1,6 +1,7 @@ from django import forms from django.conf import settings from django.core.mail import EmailMessage +from django.db.models import Q from django.forms.models import BaseModelFormSet from django.template.loader import render_to_string from django.utils.safestring import mark_safe @@ -191,7 +192,10 @@ class AddDelegateForm(RelatedWGForm): return self.next_form def get_person(self, email): - persons = PersonOrOrgInfo.objects.filter(emailaddress__address=email, iesglogin__isnull=False).distinct() + persons = PersonOrOrgInfo.objects.filter(emailaddress__address=email).filter( + Q(iesglogin__isnull=False)| + Q(legacywgpassword__isnull=False)| + Q(legacyliaisonuser__isnull=False)).distinct() if not persons: raise PersonOrOrgInfo.DoesNotExist if len(persons) > 1: @@ -244,7 +248,10 @@ class MultipleDelegateForm(AddDelegateForm): if not self.email: self.email = self.data.get('email', None) self.fields['email'].initial = self.email - self.fields['persons'].choices = [(i.pk, unicode(i)) for i in PersonOrOrgInfo.objects.filter(emailaddress__address=self.email, iesglogin__isnull=False).distinct().order_by('first_name')] + self.fields['persons'].choices = [(i.pk, unicode(i)) for i in PersonOrOrgInfo.objects.filter(emailaddress__address=self.email).filter( + Q(iesglogin__isnull=False)| + Q(legacywgpassword__isnull=False)| + Q(legacyliaisonuser__isnull=False)).distinct().order_by('first_name')] def save(self): person_id = self.cleaned_data.get('persons')