Alex Rivera | Logout

Rendering a value as text instead of field inside a Django Form

Asked 2009-07-15T21:05:10.900
22

Is there a simple way to make Django render {{myform.name}} as

John Smith

instead of

<input id="id_name" name="name" value="John Smith" />

inside <form> tags? Or am I going about this the wrong way?

Edit
Report

1 Answer

22
<form>
    {% for field in form %}
            {{ field.label }}: {{ field.value }}
    {% endfor %}
</form>

Take a look here Form fields and Working with forms

answered 2009-07-15T21:20:56.953

Your Answer