[#3328] QBD: Tri décroissant ne fonctionne pas
authorPA Parent <paparent@paparent.me>
Tue, 19 Jun 2012 14:08:05 +0000 (10:08 -0400)
committerPA Parent <paparent@paparent.me>
Tue, 19 Jun 2012 14:08:05 +0000 (10:08 -0400)
src/qbe/django_qbe/forms.py

index 374bf19..fb20a5e 100644 (file)
@@ -29,7 +29,7 @@ except AttributeError:
 SORT_CHOICES = (
     ("", ""),
     ("asc", _("Ascending")),
-    ("des", _("Descending")),
+    ("desc", _("Descending")),
 )
 
 
@@ -182,7 +182,7 @@ class BaseQueryByExampleFormSet(BaseFormSet):
             if show and not is_join:
                 selects.append(db_field)
             if sort:
-                sorts.append(db_field)
+                sorts.append((db_field, sort))
             if all(criteria):
                 if is_join:
                     over_split = over.lower().rsplit(".", 1)
@@ -228,7 +228,7 @@ class BaseQueryByExampleFormSet(BaseFormSet):
         if self._raw_query:
             return self._raw_query
         if self._sorts:
-            order_by = u"ORDER BY %s" % (", ".join(self._sorts))
+            order_by = u"ORDER BY %s" % (", ".join([" ".join(x) for x in self._sorts]))
         else:
             order_by = u""
         if self._wheres: