Two changes: (1) searches by substring rather than
"begins with" (to allow, e.g., searching by last name); and (2) limits results to 10 entries (to limit server load and limit effectiveness of email-scraping attacks) - Legacy-Id: 5519
This commit is contained in:
parent
ab5b610ce5
commit
2e740dcab8
|
@ -4,5 +4,5 @@ from ietf.person.models import *
|
|||
from ietf.person.forms import json_emails
|
||||
|
||||
def ajax_search_emails(request):
|
||||
emails = Email.objects.filter(person__alias__name__istartswith=request.GET.get('q','')).order_by('person__name').distinct()
|
||||
emails = Email.objects.filter(person__alias__name__icontains=request.GET.get('q','')).filter(active='true').order_by('person__name').distinct()[:10]
|
||||
return HttpResponse(json_emails(emails), mimetype='application/json')
|
||||
|
|
Loading…
Reference in a new issue