#19173: "query" param for Model.objects.none() queryset has unexpected value.
-----------------------------------+--------------------------------------
Reporter: joshua.fialkoff@… | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.4
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Comment (by akaariai):
We really should get rid of the whole none() -> !EmptyQuerySet. We would
get 150 lines worth of DRY code removal. The code would be more robust
(EmptyQS has had its problems, see the altered tests...). Still one more
bonus point is that a query which has had .none() applied works exactly
like normal queries (for example
qs.none().filter(nonexistingfield=someval) would raise exception
correctly.
The cost of this is speed penalty from !QuerySet cloning. The fix for this
is making cloning cheaper.
The biggest problem might be that .none() documentation explicitly
mentions !EmptyQuerySet. There is no reason the docs need to mention EQS.
Seems like leaking implementation detail to me. My opinion is to not make
a backwards compatibility issue out of this. Just noting that EQS has been
removed should be enough IMO.
Implementation available here:
https://github.com/akaariai/django/commit/915cf9e495f033a07feb6c9aaece44d735d7fe70
--
Ticket URL: <https://code.djangoproject.com/ticket/19173#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.