Changes between Initial Version and Version 1 of Ticket #29078


Ignore:
Timestamp:
Jan 28, 2018, 2:27:20 PM (7 years ago)
Author:
xx396
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29078 – Description

    initial v1  
    44from django.core import serializers
    55
    6 groups = Group.objects.prefetch_related('permissions__content_type').all()
     6groups = Group.objects.prefetch_related('permissions').all()
    77serializers.serialize('json', groups)
    88
    99This will N+1 query the permissions as handle_m2m_field uses iterator() which bypasses any cache. Suggest serializers/python.py line 77 replaces iterator() with all()
    10 
    11 self._current[field.name] = [
    12                 m2m_value(related) for related in getattr(obj, field.name).iterator()
    13             ]
Back to Top