Skip to content

Commit

Permalink
Ensure add_stator_indexes only run for direct descendants of StatorModel
Browse files Browse the repository at this point in the history
  • Loading branch information
lullis committed Jan 30, 2024
1 parent f86f3a4 commit c8dcdc9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion stator/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down

0 comments on commit c8dcdc9

Please sign in to comment.