diff mbox

[Branch,~linaro-validation/lava-server/trunk] Rev 386: obscure sorting fix for when columns are added or removed dynamically

Message ID 20120817055311.8459.63823.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Michael-Doyle Hudson Aug. 17, 2012, 5:53 a.m. UTC
------------------------------------------------------------
revno: 386
committer: Michael Hudson-Doyle <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Fri 2012-08-17 17:52:39 +1200
message:
  obscure sorting fix for when columns are added or removed dynamically
modified:
  lava/utils/data_tables/backends.py


--
lp:lava-server
https://code.launchpad.net/~linaro-validation/lava-server/trunk

You are subscribed to branch lp:lava-server.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-server/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava/utils/data_tables/backends.py'
--- lava/utils/data_tables/backends.py	2012-03-12 03:55:07 +0000
+++ lava/utils/data_tables/backends.py	2012-08-17 05:52:39 +0000
@@ -234,11 +234,12 @@ 
             return queryset
         order_by = []
         for column_index, order in sorting_columns:
-            col = self.table.columns[column_index]
+            name, col = self.table.base_columns.items()[column_index]
+            accessor = col.accessor or name
             order_by.append(
                 "{asc_desc}{column}".format(
                     asc_desc="-" if order == 'desc' else '',
-                    column=col.accessor.replace('.', '__')))
+                    column=accessor.replace('.', '__')))
         return queryset.order_by(*order_by)
 
     def process(self, query):