Django Form Name as Attribute in HTML Template -
i have attribute of objects can rendered in html template :
{{ mymodels.something }}
in case, have forms containing input field has name similar "something", want run in template:
{% form in my_form %} {{ mymodels.form.name }} <!-- same mymodels.something --> {% endfor %}
but can't rendered.. how can that?
forms gather data on client side - send on server side validates them , them (e.g. writing models, or maybe passing context of next rendering).
when template rendered, renders form (building markup, providing initial values) - when template engine finished it's job, html code sent browser.
if want access form data on rendering time, there same value: initial value. not make sense. might pass same data rendering context , use there.
read docs further information on forms, part rendering fields manually might interest - if question aims direction.
Comments
Post a Comment