Allow selection of all items on custom "list" fields. Fixes GH-23.

This commit is contained in:
Ross Poulton
2011-05-02 22:32:15 +00:00
parent c9e68a05a7
commit b42026ec33
2 changed files with 10 additions and 4 deletions

View File

@@ -1169,6 +1169,14 @@ class CustomField(models.Model):
null=True,
)
def _choices_as_array(self):
from StringIO import StringIO
valuebuffer = StringIO(self.list_values)
choices = [[item.strip(), item.strip()] for item in valuebuffer.readlines()]
valuebuffer.close()
return choices
choices_as_array = property(_choices_as_array)
required = models.BooleanField(
_('Required?'),
help_text=_('Does the user have to enter a value for this field?'),