[Django] #16856: Add a way to clear select_related

12 views
Skip to first unread message

Django

unread,
Sep 15, 2011, 2:52:15 PM9/15/11
to django-...@googlegroups.com
#16856: Add a way to clear select_related
-------------------------------------+-------------------------------------
Reporter: carljm | Owner: nobody
Type: New feature | Status: new
Milestone: | Component: Database
Version: SVN | layer (models, ORM)
Keywords: | Severity: Normal
Has patch: 0 | Triage Stage:
Needs tests: 0 | Unreviewed
Easy pickings: 0 | Needs documentation: 0
| Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
If you've got a queryset that has had select_related called on it (maybe
passed to you from some other code you don't control) there's currently no
documented way to clear out select_related.

One possible API is .select_related(None), which mirrors how .defer()
works.

The combination of this and #16855 would make .select_related() and
.defer() more consistent with each other, which would be nice.

--
Ticket URL: <https://code.djangoproject.com/ticket/16856>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 15, 2011, 4:02:18 PM9/15/11
to django-...@googlegroups.com
#16856: Add a way to clear select_related
-------------------------------------+-------------------------------------
Reporter: carljm | Owner: nobody
Type: New | Status: new
feature | Component: Database layer
Milestone: | (models, ORM)
Version: SVN | Severity: Normal
Resolution: | Keywords:
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* stage: Unreviewed => Accepted


Comment:

There was a clear consensus on this API in #django-dev.

--
Ticket URL: <https://code.djangoproject.com/ticket/16856#comment:1>

Django

unread,
Sep 20, 2011, 6:04:18 PM9/20/11
to django-...@googlegroups.com
#16856: Add a way to clear select_related
-------------------------------------+-------------------------------------
Reporter: carljm | Owner: nobody
Type: New | Status: new
feature | Component: Database layer
Milestone: | (models, ORM)
Version: SVN | Severity: Normal
Resolution: | Keywords:
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by jdunck):

* cc: jdunck@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/16856#comment:2>

Django

unread,
Dec 22, 2011, 6:12:17 AM12/22/11
to django-...@googlegroups.com
#16856: Add a way to clear select_related
-------------------------------------+-------------------------------------
Reporter: carljm | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: SVN
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by seldon):

* cc: seldon (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/16856#comment:3>

Django

unread,
Oct 7, 2012, 5:10:47 AM10/7/12
to django-...@googlegroups.com
#16856: Add a way to clear select_related
-------------------------------------+-------------------------------------
Reporter: carljm | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master

(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0

Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by bberes):

* cc: botondus@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/16856#comment:4>

Django

unread,
Oct 7, 2012, 6:01:23 AM10/7/12
to django-...@googlegroups.com
#16856: Add a way to clear select_related
-------------------------------------+-------------------------------------
Reporter: carljm | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by bberes):

For anyone reading this, the undocumented hacky way to do this is:

`qs.query.select_related = False`

--
Ticket URL: <https://code.djangoproject.com/ticket/16856#comment:5>

Django

unread,
Jan 22, 2013, 6:02:25 PM1/22/13
to django-...@googlegroups.com
#16856: Add a way to clear select_related
-------------------------------------+-------------------------------------
Reporter: carljm | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by dcramer):

Patch is here

https://github.com/django/django/pull/665

--
Ticket URL: <https://code.djangoproject.com/ticket/16856#comment:6>

Django

unread,
May 30, 2013, 9:51:11 AM5/30/13
to django-...@googlegroups.com
#16856: Add a way to clear select_related
-------------------------------------+-------------------------------------
Reporter: carljm | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0

Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by timo):

* cc: timograham@… (added)
* has_patch: 0 => 1


Comment:

Added a release note & brought patch up to date.

https://github.com/django/django/pull/1234

--
Ticket URL: <https://code.djangoproject.com/ticket/16856#comment:7>

Django

unread,
May 30, 2013, 11:07:13 AM5/30/13
to django-...@googlegroups.com
#16856: Add a way to clear select_related
-------------------------------------+-------------------------------------
Reporter: carljm | Owner: nobody
Type: New feature | Status: closed

Component: Database layer | Version: master
(models, ORM) | Resolution: fixed

Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"5074c75a37f88726f3ae057999144545881d3cfc"]:
{{{
#!CommitTicketReference repository=""
revision="5074c75a37f88726f3ae057999144545881d3cfc"
Fixed #16856 - Added a way to clear select_related.

Thanks Carl for the suggestion and David Cramer for the patch.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/16856#comment:8>

Reply all
Reply to author
Forward
0 new messages