Gustavo Picon avatar 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):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.