summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/templatetags/package_extras.py5
-rw-r--r--templates/packages/search.html2
2 files changed, 5 insertions, 2 deletions
diff --git a/packages/templatetags/package_extras.py b/packages/templatetags/package_extras.py
index 9f165580..5469f297 100644
--- a/packages/templatetags/package_extras.py
+++ b/packages/templatetags/package_extras.py
@@ -8,7 +8,10 @@ class BuildQueryStringNode(template.Node):
def render(self, context):
qs = context['querystring'].copy()
if qs.has_key('sort') and qs['sort'] == self.sortfield:
- qs['sort'] = '-' + self.sortfield
+ if self.sortfield.startswith('-'):
+ qs['sort'] = self.sortfield[1:]
+ else:
+ qs['sort'] = '-' + self.sortfield
else:
qs['sort'] = self.sortfield
return '?' + qs.urlencode()
diff --git a/templates/packages/search.html b/templates/packages/search.html
index 7e13a45c..a64b92a2 100644
--- a/templates/packages/search.html
+++ b/templates/packages/search.html
@@ -78,7 +78,7 @@
<th><a href="{% buildsortqs "pkgname" %}">Name</a></th>
<th>Version</th>
<th>Description</th>
- <th><a href="{% buildsortqs "last_update" %}">Last Updated</a></th>
+ <th><a href="{% buildsortqs "-last_update" %}">Last Updated</a></th>
</tr>
{% for pkg in results %}
<tr class="{% cycle pkgr2,pkgr1 %}">