python - Django: How can I show a list of values in a text input field? -
i have defined model manytomanyfield, , want field show values joined spaces, example:
<input type="text" name="foo" value="val1 val2 val3"/>
i have defined form use charfield represent multiple values:
class myform(modelform): foo = charfield(label='foo') class meta: model = mymodel
instead of showing values separated spaces, value shows instead:
[u'val1', u'val2', u'val3']
how can override behavior?
you have basic misunderstanding, fields aren't responsible how they're rendered. that's widgets do.
Comments
Post a Comment