#33008: Document prefetch_related for GenericForeignKey - Object doesn't exist
behaviour
--------------------------------------+------------------------------------
     Reporter:  Martin Svoboda        |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  new
    Component:  contrib.contenttypes  |                  Version:  3.2
     Severity:  Normal                |               Resolution:
     Keywords:  Documentation         |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------

Comment (by Simon Charette):

 Looks like the fetching of the object is due to the logic in `__get__`
 
https://github.com/django/django/blob/54a30a7a00fea6c5e3702282ade6e0238e06de3b/django/contrib/contenttypes/fields.py#L231-L245.

 Not sure how feasible it would be to change it without breaking backward
 compatiblity though, you'd likely need to avoid passing `default=None` to
 `get_cached_value` and differentiate the sentinel value from `None`.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33008#comment:7>
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/071.a12c590c4e2d512779256d605c2563b0%40djangoproject.com.

Reply via email to