#24614: Symmetry for select_related/prefetch_related for handling non-related
fields
-------------------------------------+-------------------------------------
     Reporter:  Naddiseo             |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  new
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Naddiseo):

 Thanks for your responses @shaib, I really do appreciate you taking the
 time to read it and being open to discussing it, I'll move the discussion
 and a reply into the mailing list, as you suggest, over the weekend (does
 the mailing list handle the table and code formatting?).

 As for your second response: I've just double checked in dj 1.8, and the
 validation only occurs if the field is on the immediate model, or if it's
 invalid:

 {{{#!python

 >>> Person.objects.select_related('foo')
 django.core.exceptions.FieldError: Invalid field name(s) given in
 select_related: 'foo'. Choices are: hometown
 >>> Person.objects.select_related('hometown__foo')
 django.core.exceptions.FieldError: Invalid field name(s) given in
 select_related: 'foo'. Choices are: mayor
 >>> Person.objects.select_related('hometown__name')
 # query = select ... blah
 [ Person object ...]
 >>> Person.objects.select_related('name')
 django.core.exceptions.FieldError: Non-relational field given in
 select_related: 'name'. Choices are: hometown

 }}}

 Notice how it will happily accept the third one. Would you like me to file
 a separate bug report for this issue?

--
Ticket URL: <https://code.djangoproject.com/ticket/24614#comment:3>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.b42c747f76f1b300bfd3680a8ba1499a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to