sort last updated descending by default. FS#10703

This commit is contained in:
Dusty Phillips 2008-06-19 20:15:01 -04:00
parent 4ee5f0862b
commit 39affe5888
2 changed files with 5 additions and 2 deletions

View File

@ -8,7 +8,10 @@ def __init__(self, sortfield):
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()

View File

@ -78,7 +78,7 @@ <h4 style="text-align: right">Search Criteria</h4>
<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 %}">