#16979: adds Q objects for related fields.
----------------------------------------------+----------------------------
     Reporter:  javier@…                      |      Owner:  nobody
         Type:  New feature                   |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  1.3
     Severity:  Normal                        |   Keywords:  Q,
 Triage Stage:  Unreviewed                    |  related_fields
Easy pickings:  0                             |  Has patch:  1
                                              |      UI/UX:  0
----------------------------------------------+----------------------------
 Inspired by this proposal by Johannes Dollinger:
 [https://groups.google.com/forum/?hl=en#!topic/django-
 developers/lH5UhciGTBw], this quick (untested!) patch allows to use

 {{{
 is_blue = Q(color='blue')
 Owner.objects.filter(thing=is_blue)
 }}}

 as a better alternative to:

 {{{
 Owner.objects.filter(thing__in=Thing.objects.filter(is_blue))
 }}}

 being better because it generates the same query as:


 {{{
 Owner.objects.filter(thing__color='blue')
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16979>
Django <https://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 django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to