diff --git a/schedule/models/calendars.py b/schedule/models/calendars.py index 81f8a7de..d37097a7 100644 --- a/schedule/models/calendars.py +++ b/schedule/models/calendars.py @@ -231,7 +231,7 @@ class CalendarRelation(models.Model): class Meta: verbose_name = _("calendar relation") verbose_name_plural = _("calendar relations") - index_together = [("content_type", "object_id")] + indexes = [models.Index(fields=["content_type", "object_id"])] def __str__(self): return "{} - {}".format(self.calendar, self.content_object) diff --git a/schedule/models/events.py b/schedule/models/events.py index bf6fa5f1..bc9671c5 100644 --- a/schedule/models/events.py +++ b/schedule/models/events.py @@ -92,7 +92,7 @@ class Event(models.Model): class Meta: verbose_name = _("event") verbose_name_plural = _("events") - index_together = (("start", "end"),) + indexes = [models.Index(fields=["start", "end"])] def __str__(self): return gettext("%(title)s: %(start)s - %(end)s") % { @@ -571,7 +571,7 @@ class EventRelation(models.Model): class Meta: verbose_name = _("event relation") verbose_name_plural = _("event relations") - index_together = [("content_type", "object_id")] + indexes = [models.Index(fields=["content_type", "object_id"])] def __str__(self): return "{}({})-{}".format( @@ -594,7 +594,7 @@ class Occurrence(models.Model): class Meta: verbose_name = _("occurrence") verbose_name_plural = _("occurrences") - index_together = (("start", "end"),) + indexes = [models.Index(fields=["start", "end"])] def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs)