fix QuerySet constructor for django 1.2
authorjlaine <jlaine@e071eeec-0327-468d-9b6a-08194a12b294>
Mon, 24 May 2010 09:35:02 +0000 (09:35 +0000)
committerjlaine <jlaine@e071eeec-0327-468d-9b6a-08194a12b294>
Mon, 24 May 2010 09:35:02 +0000 (09:35 +0000)
git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@868 e071eeec-0327-468d-9b6a-08194a12b294

ldapdb/models/query.py

index 738124f0db7f2654613bfd5c0f85612e748eb689..020d4eeb7d4a9bf3d03c6242ad296ade8789e0a2 100644 (file)
@@ -158,8 +158,15 @@ class Query(BaseQuery):
             yield row
 
 class QuerySet(BaseQuerySet):
-    def __init__(self, model=None, query=None):
+    def __init__(self, model=None, query=None, using=None):
         if not query:
-            query = Query(model, None, WhereNode)
+            import inspect
+            spec = inspect.getargspec(Query.__init__)
+            if len(spec[0]) == 3:
+                # django 1.2
+                query = Query(model, WhereNode)
+            else:
+                # django 1.1
+                query = Query(model, None, WhereNode)
         super(QuerySet, self).__init__(model, query)