﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29078	Serializer handle_m2m_field should honour any previous prefetch	xx396	nobody	"Example:

from django.contrib.auth.models import Group
from django.core import serializers

groups = Group.objects.prefetch_related('permissions__content_type').all()
serializers.serialize('json', groups)

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()

self._current[field.name] = [
                m2m_value(related) for related in getattr(obj, field.name).iterator()
            ]"	Bug	new	Core (Serialization)	2.0	Normal				Unreviewed	0	0	0	0	1	0
