Explorar o código

TreeManager should provide an unrestricted QuerySet for MPTT use

Jeremy Stretch %!s(int64=5) %!d(string=hai) anos
pai
achega
327a93136a
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      netbox/utilities/mptt.py

+ 5 - 1
netbox/utilities/mptt.py

@@ -16,4 +16,8 @@ class TreeManager(Manager.from_queryset(TreeQuerySet), TreeManager_):
     """
     Extend django-mptt's TreeManager to incorporate RestrictedQuerySet().
     """
-    pass
+    def db_manager(self, using=None, hints=None):
+        manager = super().db_manager(using, hints)
+
+        # Return an unrestricted QuerySet for use by MPTT
+        return manager.unrestricted()