Proposed solution:
in db/models/manager.py
{{{
def get_queryset(self):
return self._queryset_class(model=self.model, using=self._db,
hints=self._hints)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24911>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Old description:
> QuerySet is initiated with model=None as named argument a.k.a. kwarg:
> {{{
> class QuerySet(object):
> def __init__(self, model=None, query=None, using=None, hints=None):
> }}}
> But it is called in get_queryset as positional argument a.k.a. arg:
> {{{
> def get_queryset(self):
> return self._queryset_class(self.model, using=self._db,
> hints=self._hints)
> }}}
> This causes trouble when overriding get_queryset (which is the idea
> behind the method) and using super(BlaBlaManager, self).get_queryset()
> which returns a non-standard queryset-class, where model is not
> necessarily the first argument, which should have been okay as model is a
> named argument.
>
> Proposed solution:
> in db/models/manager.py
> {{{
> def get_queryset(self):
> return self._queryset_class(model=self.model, using=self._db,
> hints=self._hints)
> }}}
New description:
QuerySet is initiated with {{{model=None}}} as named argument a.k.a.
kwarg:
{{{
class QuerySet(object):
def __init__(self, model=None, query=None, using=None, hints=None):
}}}
But it is called in {{{get_queryset()}}} as positional argument a.k.a.
arg:
{{{
def get_queryset(self):
return self._queryset_class(self.model, using=self._db,
hints=self._hints)
}}}
This causes trouble when overriding {{{get_queryset}}} (which is the idea
behind the method) and using {{{super(BlaBlaManager,
self).get_queryset()}}} which returns a non-standard queryset-class, where
model is not necessarily the first argument, which should have been okay
as model is a named argument.
Proposed solution:
in db/models/manager.py
{{{
def get_queryset(self):
return self._queryset_class(model=self.model, using=self._db,
hints=self._hints)
}}}
Github pull request: https://github.com/django/django/pull/4745
--
--
Ticket URL: <https://code.djangoproject.com/ticket/24911#comment:1>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/24911#comment:2>
* needs_tests: 0 => 1
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/24911#comment:3>
* owner: nobody => 317070
* status: new => assigned
* needs_tests: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/24911#comment:4>
* status: assigned => closed
* resolution: => fixed
--
Ticket URL: <https://code.djangoproject.com/ticket/24911#comment:5>
* status: closed => new
* resolution: fixed =>
--
Ticket URL: <https://code.djangoproject.com/ticket/24911#comment:6>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"4352e865a75923a0e5036b4e9ba2a8f0bfae3d63" 4352e865]:
{{{
#!CommitTicketReference repository=""
revision="4352e865a75923a0e5036b4e9ba2a8f0bfae3d63"
Fixed #24911 -- Made BaseManager.get_queryset() allow custom queryset
args.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24911#comment:7>