Create lists only under certain conditions

This commit is contained in:
sol HYUN 2016-12-06 00:18:33 +09:00
parent 8e332ad16f
commit 7ed8a480a3

View File

@ -422,7 +422,10 @@ class Field(object):
if getattr(self.root, 'partial', False): if getattr(self.root, 'partial', False):
return empty return empty
return self.default_empty_html return self.default_empty_html
ret = dictionary.getlist(self.field_name) if len(dictionary.getlist(self.field_name)) > 1:
ret = dictionary.getlist(self.field_name)
else:
ret = dictionary.get(self.field_name)
if ret == '' and self.allow_null: if ret == '' and self.allow_null:
# If the field is blank, and null is a valid value then # If the field is blank, and null is a valid value then
# determine if we should use null instead. # determine if we should use null instead.