Fixed a problem with the spiffy ajax handling of email fields when test cases submit a textual list of email addresses instead of a python list.

- Legacy-Id: 4937
This commit is contained in:
Henrik Levkowetz 2012-10-21 14:34:50 +00:00
parent 1f8cc48792
commit 471cd05bac

View file

@ -4,9 +4,13 @@ from django.utils.functional import lazy
from django import forms
from django.core.urlresolvers import reverse as urlreverse
import debug
from ietf.person.models import *
def json_emails(emails):
if isinstance(emails, basestring):
emails = Email.objects.filter(address__in=[x.strip() for x in emails.split(",") if x.strip()]).select_related("person")
return simplejson.dumps([{"id": e.address + "", "name": escape(u"%s <%s>" % (e.person.name, e.address))} for e in emails])
class EmailsField(forms.CharField):