From 021d16b015534f90f484c2246adf718afc7753de Mon Sep 17 00:00:00 2001 From: Raphael Lullis Date: Tue, 30 Jan 2024 20:00:23 +0100 Subject: [PATCH] Ensure add_stator_indexes only run for direct descendants of StatorModel --- stator/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stator/models.py b/stator/models.py index 377c7e842..afe0333dc 100644 --- a/stator/models.py +++ b/stator/models.py @@ -44,8 +44,11 @@ def add_stator_indexes(sender, **kwargs): Inject Indexes used by StatorModel in to any subclasses. This sidesteps the current Django inability to inherit indexes when the Model subclass defines its own indexes. + + We should only add this for models that direct descendants of + StatorModel, otherwise we will see system check errors. """ - if issubclass(sender, StatorModel): + if sender.__base__ is StatorModel: indexes = [ models.Index( fields=["state", "state_next_attempt", "state_locked_until"],