My favorites | Sign in
Google
                
New issue | Search
for
| Advanced search | Search tips
Issue 415: djangoforms renders StringListProperty incorrectly
11 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ma...@google.com
Closed:  Oct 2008
Type-Defect
Priority-Medium


Sign in to add a comment
 
Reported by speigei, May 31, 2008
What steps will reproduce the problem?
Model:
class Test(db.Model):
    items = db.StringListProperty()    

View:
def test(request):  
    class TestForm(djangoforms.ModelForm):
        class Meta:
            model = Test
            
    form = TestForm()
    return render_to_response('test.html', {'form':form})

What is the expected output? What do you see instead?
According to appengine.ext.db.djangoforms ListProperties are supposed to 
rendered in a Textarea, with one value on each line.
However in my Test a Inputfield ist rendered with a value of "[]". 
Changing this value to that "['test']" results in a value of 
"[,',t,e,s,t,',]" in the data store. 

What version of the product are you using? On what operating system?
vista, 1.1.0
Comment 1 by speigei, Jul 11, 2008
Here's a workaround:

in ext.db.__init__, StringListProperty function (line 2144), remove it and replace with:

class StringListProperty(ListProperty):
  def __init__(self, verbose_name=None, default=None, **kwds):
      return super(StringListProperty, self).__init__(basestring, verbose_name,
default, **kwds)
Comment 2 by j...@google.com, Aug 19, 2008
(No comment was entered for this change.)
Status: Accepted
Owner: ma...@google.com
Comment 3 by ma...@google.com, Oct 03, 2008
(No comment was entered for this change.)
Status: Fixed
Sign in to add a comment