Fixed #2599 -- Fixed rendering problem in comma-separated integer fields.

Thanks, Christopher Lenz.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3804 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2006-09-23 12:11:37 +00:00
parent 539438a231
commit 00734bca7e
1 changed files with 7 additions and 0 deletions

View File

@ -969,6 +969,13 @@ class CommaSeparatedIntegerField(TextField):
except validators.ValidationError, e: except validators.ValidationError, e:
raise validators.CriticalValidationError, e.messages raise validators.CriticalValidationError, e.messages
def render(self, data):
if data is None:
data = ''
elif isinstance(data, (list, tuple)):
data = ','.join(data)
return super(CommaSeparatedIntegerField, self).render(data)
class RawIdAdminField(CommaSeparatedIntegerField): class RawIdAdminField(CommaSeparatedIntegerField):
def html2python(data): def html2python(data):
if data: if data: