initial values for form fields

This commit is contained in:
Sanj 2012-04-22 17:22:03 +05:30
parent 6c148370e7
commit 893e44b5e8
2 changed files with 12 additions and 11 deletions

View File

@ -212,7 +212,8 @@ def shipList(request):
'no_of_pages': paginator.num_pages,
'page': page,
'page_size': page_size,
'no_of_results': no_of_results
'no_of_results': no_of_results,
'params': request.GET
})

View File

@ -29,33 +29,33 @@ No of results: {{ no_of_results }}   displaying page {{ page }} of {{ no_of
<form id="shipFilterForm" action="" method="GET">
<label for="id_start_date">Start Date:</label>
<input type="date" name="start_date" id="id_start_date" /> <br />
<input type="date" name="start_date" value="{{ params.start_date }}" id="id_start_date" /> <br />
<label for="id_end_date">End Date:</label>
<input type="date" name="end_date" id="id_end_date" /> <br />
<input type="date" name="end_date" value="{{ params.end_date }}" id="id_end_date" /> <br />
<label for="id_bill_type">Bill Type:</label>
<select name="bill_type" id="id_bill_type">
<option value="">-----</option>
<option value="Import">Import</option>
<option value="Export">Export</option>
<option value="Rexport">Rexport</option>
<option value="Import" {% ifequal params.bill_type "Import" %} selected="selected" {% endifequal %}>Import</option>
<option value="Export" {% ifequal params.bill_type "Export" %} selected="selected" {% endifequal %}>Export</option>
<option value="Rexport" {% ifequal params.bill_type "Rexport" %} selected="selected" {% endifequal %}>Rexport</option>
</select><br />
<label for="id_ship_name">Ship Name:</label>
<input type="text" name="ship_name" id="id_ship_name" /> <br />
<input type="text" name="ship_name" value="{{ params.ship_name }}" id="id_ship_name" /> <br />
<label for="id_port">Port:</label>
<input type="text" name="port" id="id_port" /><br />
<input type="text" name="port" id="id_port" value="{{ params.port }}" /><br />
<label for="id_captain">Captain:</label>
<input type="text" name="captain" id="id_captain" /><br />
<input type="text" name="captain" id="id_captain" value="{{ params.captain }}" /><br />
<label for="id_owner">Owner:</label>
<input type="text" name="owner" id="id_owner" /><br />
<input type="text" name="owner" id="id_owner" value="{{ params.owner }}" /><br />
<label for="id_goods">Goods:</label>
<input type="text" name="goods" id="id_goods" /><br />
<input type="text" name="goods" id="id_goods" value="{{ params.goods }}" /><br />
<input type="submit" value="Submit" />
</form>