Changes between Initial Version and Version 1 of Ticket #29078
- Timestamp:
- Jan 28, 2018, 2:27:20 PM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #29078 – Description
initial v1 4 4 from django.core import serializers 5 5 6 groups = Group.objects.prefetch_related('permissions __content_type').all()6 groups = Group.objects.prefetch_related('permissions').all() 7 7 serializers.serialize('json', groups) 8 8 9 9 This 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 ]