From 506f800eadea2ab8c9d90f00278b4b03f3a9b771 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Fri, 19 Jul 2019 13:05:31 +0200 Subject: [PATCH] [2.2.x] Refs #30083 -- Added a warning about performing queries in pre/post_init receivers. Thanks Carlton Gibson the review. Backport of fc1182af01c391ce33d7fcf51c756829c6a11d5b from master --- docs/ref/signals.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/ref/signals.txt b/docs/ref/signals.txt index a89560cc1e6..19a92a875c4 100644 --- a/docs/ref/signals.txt +++ b/docs/ref/signals.txt @@ -106,6 +106,12 @@ Arguments sent with this signal: ``_state.db`` is ``None`` and cannot be used to check an ``instance`` database. +.. warning:: + + For performance reasons, you shouldn't perform queries in receivers of + ``pre_init`` or ``post_init`` signals because they would be executed for + each instance returned during queryset iteration. + ``pre_save`` ------------