#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):

 I didn't look at the issue in detail but I assume this is happening due to
 the prefetching logic performing a `tags_2[0].content_object = None`
 assignment.

 How does the following code behaves?

 {{{#!python
 tags_1 = TaggedItem.objects.filter(tag='test')
 tags_1.content_object = None
 assert tags_1.object_id is None
 assert tags_1.content_type_id is None
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33008#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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.52b0e17ba5c4ebe9d735a0fe3118afd1%40djangoproject.com.

Reply via email to