The built-in methods as_html, as_ul, as_p in Django formats do not work for me, as well as the built-in rendering {{field}}, so I am trying to write personalized rendering of the form.
Here is what I still have:
<input id="id_{{field.html_name}}"
type="text"
name="{{field.html_name}}"
placeholder="{{field.label}}" <!-- "placeholder" is really the only reason I need to do a custom implementation -->
value="{{ XXX }}" <!-- what goes here? -->
maxlength="30" />
The question is what should go in the value attribute (marked XXXabove)?
I looked around a bit and did not find that BoundFieldthe valueor attribute supports data. I use ModelForms if that matters
source
share