Re: [Django] #14196: Objects that come from something_set, should have their parent object filled in

17 views
Skip to first unread message

Django

unread,
Jun 5, 2015, 5:41:25 AM6/5/15
to django-...@googlegroups.com
#14196: Objects that come from something_set, should have their parent object
filled in
-------------------------------------+-------------------------------------
Reporter: mark0978 | Owner: zedr
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
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 zedr):

* owner: nobody => zedr
* status: new => assigned


Comment:

Assigning to myself for work.

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

Django

unread,
Jun 5, 2015, 8:41:14 AM6/5/15
to django-...@googlegroups.com
#14196: Objects that come from something_set, should have their parent object
filled in
-------------------------------------+-------------------------------------
Reporter: mark0978 | Owner: zedr
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
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
-------------------------------------+-------------------------------------

Comment (by zedr):

I cannot reproduce this using the following test:

{{{
def test_prepopulated_parent_of_a_set(self):
my_user = User.objects.create(username="MyUser")
LogEntry.objects.create(user=my_user, action_flag=0)

user_logs = my_user.logentry_set.all()
first_log = user_logs[0]
with self.assertNumQueries(0):
log_user = first_log.user
self.assertEquals(my_user.username, log_user.username)
}}}

This test passes, meaning no additional queries were executed when
attempting to lookup the parent user. Maybe I'm missing something obvious?

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

Django

unread,
Jun 5, 2015, 8:42:19 AM6/5/15
to django-...@googlegroups.com
#14196: Objects that come from something_set, should have their parent object
filled in
-------------------------------------+-------------------------------------
Reporter: mark0978 | Owner:
Type: New feature | Status: new

Component: Database layer | Version: master
(models, ORM) |
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 zedr):

* status: assigned => new
* owner: zedr =>


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

Django

unread,
Jun 5, 2015, 12:00:43 PM6/5/15
to django-...@googlegroups.com
#14196: Objects that come from something_set, should have their parent object
filled in
-------------------------------------+-------------------------------------
Reporter: mark0978 | Owner:
Type: New feature | Status: closed

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

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 timgraham):

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


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

Django

unread,
Jun 5, 2015, 12:10:56 PM6/5/15
to django-...@googlegroups.com
#14196: Objects that come from something_set, should have their parent object
filled in
-------------------------------------+-------------------------------------
Reporter: mark0978 | Owner:
Type: New feature | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by carljm):

Thanks for investigating!

--
Ticket URL: <https://code.djangoproject.com/ticket/14196#comment:9>

Django

unread,
Jun 6, 2015, 3:43:26 PM6/6/15
to django-...@googlegroups.com
#14196: Objects that come from something_set, should have their parent object
filled in
-------------------------------------+-------------------------------------
Reporter: mark0978 | Owner:
Type: New feature | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by mark0978):

I'm betting over the course of the last 5 years this got fixed. Might be
a good idea to add the test code to prevent regression though.

--
Ticket URL: <https://code.djangoproject.com/ticket/14196#comment:10>

Django

unread,
Jun 7, 2015, 12:47:37 PM6/7/15
to django-...@googlegroups.com
#14196: Objects that come from something_set, should have their parent object
filled in
-------------------------------------+-------------------------------------
Reporter: mark0978 | Owner:
Type: New feature | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by aaugustin):

`known_related_objects.tests.ExistingRelatedInstancesTests.test_foreign_key`
tests this.

I couldn't find easily when it was introduced because the
modeltests/regressiontests merge breaks git log.

--
Ticket URL: <https://code.djangoproject.com/ticket/14196#comment:11>

Reply all
Reply to author
Forward
0 new messages