From: jlaine Date: Mon, 24 May 2010 09:35:02 +0000 (+0000) Subject: fix QuerySet constructor for django 1.2 X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=3912bd6478e2c17a4ea171840a50d1d78ca2694c;p=matthijs%2Fupstream%2Fdjango-ldapdb.git fix QuerySet constructor for django 1.2 git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@868 e071eeec-0327-468d-9b6a-08194a12b294 --- diff --git a/ldapdb/models/query.py b/ldapdb/models/query.py index 738124f..020d4ee 100644 --- a/ldapdb/models/query.py +++ b/ldapdb/models/query.py @@ -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)