summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
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()