#3358: select_related() should work with ValueQuerySets
---------------------------------------------+------------------------------
Reporter: dbr <[EMAIL PROTECTED]> | Owner: adrian
Status: new | Component: Database
wrapper
Version: | Resolution:
Keywords: | Stage: Design
decision needed
Has_patch: 0 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
---------------------------------------------+------------------------------
Changes (by Michael Radziej <[EMAIL PROTECTED]>):
* version: 0.95 =>
* summary: select_related() and selecting by db table fields =>
select_related() should work with
ValueQuerySets
Comment:
I've changed the summary to something that hopefully expresses your idea.
So, what result *would* you expect? Something like the following?
{{{
>>> Trackback.objects.select_related().values('blog', 'title')
[{'blog': <Blog object>, 'title': 'Tracback entry'}, {'blog': <block
object>, 'title': 'Trackback entry 2'}]
}}}
That would break compatibility, and we usually don't do this if we can
avoid it. How about:
{{{
>>> Trackback.objects.select_related().values('blog__date',
'blog__author', 'title')
[{'blog': {'author': 'Mr. Sunshine', 'Date': ...}, 'title': 'Tracback
entry'}}, ... }]
}}}
{{{values('blog'} }}} would still be allowed with the old result, but
discouraged and can't be used together with the extension.
For one-to-many or many-to-many relationships, the value in the dict could
be a list of dicts. Hey, what I like about this is that it would give a
good way to define a limited select_related.
Can you please state your opinion and start a discussion on django-
developers? This should really be discussed on the list.
There's a related ticket about limiting select_related: #3275
--
Ticket URL: <http://code.djangoproject.com/ticket/3358#comment:4>
Django Code <http://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 this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---