]> git.ozlabs.org Git - patchwork/blobdiff - apps/patchwork/utils.py
pwclient: honor PAGER for view
[patchwork] / apps / patchwork / utils.py
index 9e1702e647673c6295fbe36524946895be83392d..9ed9e41e35f60affafe0e791ed01d978a6c271ad 100644 (file)
@@ -99,7 +99,7 @@ class Order(object):
         if self.reversed:
             q = '-' + q
 
-        qs = qs.order_by(q)
+        orders = [q]
 
         # if we're using a non-default order, add the default as a secondary
         # ordering. We reverse the default if the primary is reversed.
@@ -108,9 +108,9 @@ class Order(object):
             q = self.order_map[default_name]
             if self.reversed ^ default_reverse:
                 q = '-' + q
-            qs = qs.order_by(q)
+            orders.append(q)
 
-        return qs
+        return qs.order_by(*orders)
 
 bundle_actions = ['create', 'add', 'remove']
 def set_bundle(user, project, action, data, patches, context):
@@ -191,8 +191,8 @@ def send_notifications():
         projects = set([ n.patch.project.linkname for n in notifications ])
 
         def delete_notifications():
-            PatchChangeNotification.objects.filter(
-                                pk__in = notifications).delete()
+            pks = [ n.pk for n in notifications ]
+            PatchChangeNotification.objects.filter(pk__in = pks).delete()
 
         if EmailOptout.is_optout(recipient.email):
             delete_notifications()