summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorDusty Phillips <buchuki@gmail.com>2008-06-19 20:15:01 -0400
committerDusty Phillips <buchuki@gmail.com>2008-06-19 20:15:01 -0400
commit39affe588899b67c0bcd7e290c54d3ebb5c0b0f0 (patch)
tree9acc3646e4e1a802c405acc0455293f007177363 /packages
parent4ee5f0862be1d13f69e4ddf552e415eb0f40061f (diff)
sort last updated descending by default. FS#10703
Diffstat (limited to 'packages')
-rw-r--r--packages/templatetags/package_extras.py5
1 files changed, 4 insertions, 1 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()