This is because the p you submit to your view is a QuerySet, not an instance of an object. Try the following:
{% for p_object in p %} <tr> <td width="20%" class="scratchblackfont12">Release Name :</td> <td><div style="overflow:auto"><input name="Release Name (if any ):" autocomplete="on" type="text" class="scratchsearchfield" elname="defaultFocus" id="r1" value="{{p_object.version}}" READONLY multiline="true" ></div> </td> </tr> {% endfor %}
If you want to send a specific instance of p , you will need to do the following in your view:
p = Discussion.objects.get(version=m2)
but note that get throws an error if the request returns more than one object with version = m2.
source share