[extensions-web] Allow sorting by popularity, as another hidden feature
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] Allow sorting by popularity, as another hidden feature
- Date: Sun, 18 Dec 2011 00:50:34 +0000 (UTC)
commit a484e288fdf87a63a5eaa6948bedbc896d4a7bd8
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Dec 15 17:46:04 2011 -0500
Allow sorting by popularity, as another hidden feature
sweettooth/extensions/views.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/sweettooth/extensions/views.py b/sweettooth/extensions/views.py
index b45847e..ff9bb91 100644
--- a/sweettooth/extensions/views.py
+++ b/sweettooth/extensions/views.py
@@ -83,8 +83,12 @@ def shell_update(request):
@ajax_view
def ajax_extensions_list(request):
queryset = models.Extension.objects.visible()
- if request.GET.get('sort', '') == 'recent':
+ sort = request.GET.get('sort', '')
+
+ if sort == 'recent':
queryset = queryset.order_by('-pk')
+ elif sort == 'popularity':
+ queryset = queryset.order_by('-downloads')
else:
queryset = queryset.order_by('name')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]