Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix django warnings #558

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated by Django 4.1 on 2023-10-17 11:20

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("schedule", "0014_use_autofields_for_pk"),
]

operations = [
migrations.RenameIndex(
model_name="calendarrelation",
new_name="schedule_ca_content_cddadb_idx",
old_fields=("content_type", "object_id"),
),
migrations.RenameIndex(
model_name="event",
new_name="schedule_ev_start_a258cb_idx",
old_fields=("start", "end"),
),
migrations.RenameIndex(
model_name="eventrelation",
new_name="schedule_ev_content_6ceecb_idx",
old_fields=("content_type", "object_id"),
),
migrations.RenameIndex(
model_name="occurrence",
new_name="schedule_oc_start_76a2f8_idx",
old_fields=("start", "end"),
),
]
4 changes: 3 additions & 1 deletion schedule/models/calendars.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ 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)
12 changes: 9 additions & 3 deletions schedule/models/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ 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") % {
Expand Down Expand Up @@ -571,7 +573,9 @@ 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(
Expand All @@ -594,7 +598,9 @@ 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)
Expand Down
2 changes: 0 additions & 2 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@

USE_I18N = True

USE_L10N = True

USE_TZ = True

PASSWORD_HASHERS = ["django.contrib.auth.hashers.SHA1PasswordHasher"]
Expand Down