This commit is contained in:
Sanj 2012-04-22 17:33:32 +05:30
parent 893e44b5e8
commit efe73aec2e
2 changed files with 13 additions and 0 deletions

View File

@ -179,6 +179,7 @@ def shipList(request):
owner = request.GET.get('owner', '')
port = request.GET.get('port', '')
goods = request.GET.get('goods', '')
sort = request.GET.get('sort', 'date')
# country = request.GET.get('country', None)
qset = Ship.objects.all()
if startDate != '':
@ -204,6 +205,7 @@ def shipList(request):
qset = qset.filter(good__description_string_trans__icontains=goods).distinct()
# if country:
# qset = qset.filter(country__icontains=country)
qset = qset.sort_by('date')
paginator = Paginator(qset, page_size)
results = paginator.page(page)
no_of_results = qset.count()

View File

@ -27,6 +27,17 @@ No of results: {{ no_of_results }}   displaying page {{ page }} of {{ no_of
</div>
<div id="leftCol">
<form id="shipFilterForm" action="" method="GET">
<label for="id_sort">Sort By:</label>
<select id="id_sort" name="sort">
<option value="number" {% ifequal params.sort "number" %}>Ship Number Ascending</option>
<option value="-number" {% ifequal params.sort "-number" %}>Ship Number Descending</option>
<option value="date" {% ifequal params.sort "date" %}>Date Ascending</option>
<option value="-date" {% ifequal params.sort "-date" %}>Date Descending</option>
<option value="ship_name_trans" {% ifequal params.sort "ship_name_trans" %}>Ship Name Ascending</option>
<option value="-ship_name_trans" {% ifequal params.sort "-ship_name_trans" %}>Ship Name Descending</option>
<option value="port" {% ifequal params.sort "port" %}>Port Name Ascending</option>
<option value="-port" {% ifequal params.sort "-port" %}>Port Name Descending</option>
</select>
<label for="id_start_date">Start Date:</label>
<input type="date" name="start_date" value="{{ params.start_date }}" id="id_start_date" /> <br />