Hi, I’m trying to include an inherited field from an inherited class in the subclass’ compound index. E.g.:
from django.db import models
# Create your models here.
class Base(models.Model):
name = models.CharField(max_length=20, db_index=True)
class Child(Base):
age = models.IntegerField()
class Meta:
indexes = [
models.Index(
fields = ['name', 'age']
)]
Django complains
python manage.py makemigrations
SystemCheckError: System check identified some issues:
ERRORS:
demo.Child: (models.E016) 'indexes' refers to field 'name' which is not local to model 'Child'.
HINT: This issue may be caused by multi-table inheritance.
Is there a way to include an inherited field in a compound index? Thank you so much!