Rendering a Value as Text in a Django ModelForm

Posted by: scoopseven 13 years ago

If you need to render a Django ModelFormField as text, that is, the value of that form field as text, you can do so by referring to the bound instance for the ModelForm, like so:

{{myform.instance.name}}

It's documented here and I found the solution on Stackoverlow (big surprise) although it wasn't the top rated/accepted solution (I don't think the question specified ModelForm).

Currently unrated


Recent Tweets

Recent Posts

Archive

2013
2012
2011
2010
2009
2008
2007
2006

Categories

Authors

Feeds

RSS / Atom