#33242: Annotate a related field
-------------------------------------+-------------------------------------
               Reporter:  rossm6     |          Owner:  nobody
                   Type:  New        |         Status:  new
  feature                            |
              Component:  Database   |        Version:  3.2
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:  orm
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 I think it would be sensible to allow this -



 {{{
 m = Message.objects.annotate(room__something=Value('DOH',
 output_field=CharField())).select_related('room')

 m.room.something == 'DOH' # is true
 }}}

 Perhaps the annotate API should accept a kwarg -

 {{{
 m = Message.objects.annotate(room__something=Value('DOH',
 output_field=CharField()), annotate_related=True).select_related('room')

 m.room.something == 'DOH' # is true
 }}}

 https://stackoverflow.com/questions/69771898/is-there-a-way-to-annotate-a
 -related-field-in-django

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33242>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.1a9ed952c0d5967533eab6b10c7c3eb3%40djangoproject.com.

Reply via email to