Regression introduced by commit 97774429. Refs #21410. Conflicts: tests/prefetch_related/tests.py Backport of d3b71b97 from master