Vivek S
Vivek S

Reputation: 5550

how to display django form field in template withou value?

I have a django form, with values initialized.But i dont want the values to be displayed to the user.I am using {{formobject.fieldname}} in template but it displays the value too.Is there any option to hide the field value alone?

Upvotes: 0

Views: 892

Answers (1)

Alasdair
Alasdair

Reputation: 309099

Initialise a second, unbound form in your view,

blank_form = MyForm()

then use this form to render your blank fields in the template.

{{ blank_form.fieldname }}

Upvotes: 1

Related Questions