﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29908	Foreign key isn't set on object after related set access if ForeignKey uses to_field	Carsten Fuchs	nobody	"Using the example models Blog and Entry from https://docs.djangoproject.com/en/2.1/topics/db/queries/#related-objects, this code:

{{{
#!python
    b = Blog.objects.get(name=""..."")
    for e in b.entry_set.all():
        print(e.blog)   # e.blog == b
}}}
should not trigger an access to the database, because `e.blog == b`.
Instead, for ''each'' `e`, the access to `e.blog` unexpectedly causes a query to fetch the blog object.

(Originally posted at https://groups.google.com/d/msg/django-users/Jwk9yd8Mikc/DhaEf8I5BgAJ)
"	Bug	closed	Database layer (models, ORM)	1.11	Normal	fixed			Accepted	1	0	0	0	0	0
