Hi devs,
I just came up with the following scenario:
class A(models.Model):
# some fields...
b = models.ForeignKey(B)
class B(models.Model):
# other fields
A simple FK relationship. Well, then I wanted to fetch objects from 'A'
model but just for retrieve the related 'B', so I tried something like:
A.objects.only('b').all()
I hoped it was going to be smart enough to check that I'm accessing to FK
and then do 'select_related' for that field behind the scenes, but it
doesn't, so I needed to chain the select_related myself.
Is there any reason for this behaviour? If not, would it be a good patch to
submit?
Thanks,
--
Pablo Recio
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.