email addresses have associated Datatracker accounts - this takes effect immediately for the JS auto-complete thing, but the actual validation afterwards doesn't actually require it yet (check commented out for the time being), as it appears there are still a few people without accounts in active groups - Legacy-Id: 8277
15 lines
644 B
Python
15 lines
644 B
Python
from django.http import HttpResponse
|
|
from django.db.models import Q
|
|
|
|
from ietf.person.models import Email
|
|
from ietf.person.fields import json_emails
|
|
|
|
def ajax_search_emails(request):
|
|
q = request.GET.get('q', '').strip()
|
|
emails = Email.objects.filter(Q(person__alias__name__icontains=q) |
|
|
Q(address__icontains=q))
|
|
if request.GET.get("user") == "1":
|
|
emails = emails.exclude(person__user=None) # require an account at the Datatracker
|
|
emails = emails.filter(active=True).order_by('person__name').distinct()[:10]
|
|
return HttpResponse(json_emails(emails), content_type='application/json')
|