From efe73aec2e3824aedc0622ed9c654e3aa4ad3065 Mon Sep 17 00:00:00 2001 From: Sanj Date: Sun, 22 Apr 2012 17:33:32 +0530 Subject: [PATCH] add sort --- manifests/ships/views.py | 2 ++ manifests/templates/shipList.html | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/manifests/ships/views.py b/manifests/ships/views.py index 88e9d1d..8bd79e8 100644 --- a/manifests/ships/views.py +++ b/manifests/ships/views.py @@ -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() diff --git a/manifests/templates/shipList.html b/manifests/templates/shipList.html index cea5e7c..1ccc6ba 100644 --- a/manifests/templates/shipList.html +++ b/manifests/templates/shipList.html @@ -27,6 +27,17 @@ No of results: {{ no_of_results }}   displaying page {{ page }} of {{ no_of
+ +