Commits

Gustavo Picon committed 7760807 Merge

Fixed Django 1.4 support in the admin, merged moberley's branch.

Comments (0)

Files changed (3)

     * Alejandro Peralta
     * Jaap Roes
     * Alexei Vlasov
+    * moberley
 * Fixed ManyToMany form field save handling
 * Documented a Django bug in mp_tree.rst, marked some delete tests as
   expected failures under certain conditions (issue #44)
+* In the admin, the node is now saved when moving so it can trigger handlers
+  and/or signals.
+* Improved translation files, including javascript.
+* Fixed Django 1.4 support in the admin.
 
 Release 1.61 (Jul 24, 2010)
 ---------------------------

treebeard/admin.py

 
 class TreeChangeList(ChangeList):
 
-    def get_ordering(self):
+    def get_ordering(self, *args):
         """
-        Overriding default's ChangeList.get_ordering so we don't sort the
-        results by '-id' as default
+        Overriding ChangeList.get_ordering if using the Django version <= 1.3
+        default of '-id' but passing through the >= 1.4 default of '[]'.
         """
-        if not check_empty_dict(self.params):
-            return super(TreeChangeList, self).get_ordering()
-        return None, 'asc'
+        ordering = super(TreeChangeList, self).get_ordering(*args)
+
+        if not isinstance(ordering, list):
+            if not check_empty_dict(self.params):
+                return ordering
+            else:
+                return None, 'asc'
+
+        return ordering
 
 
 class TreeAdmin(admin.ModelAdmin):
     change_list_template = 'admin/tree_change_list.html'
     form = MoveNodeForm
 
-    def get_changelist(self, request):
+    def get_changelist(self, request, **kwargs):
         return TreeChangeList
 
     def queryset(self, request):