Skip to content

Commit

Permalink
Log model indexes declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
francesco-filicetti committed Nov 30, 2024
1 parent 5abd0b5 commit 9b07b68
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/cms/templates/migrations/0015_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class Migration(migrations.Migration):
"verbose_name": "log entry",
"verbose_name_plural": "log entries",
"ordering": ["-action_time"],
"index_together": {("content_type", "object_id")},
'indexes': [models.Index(fields=['content_type', 'object_id'], name='cms_templates_log_ctype_objid_idx')],
},
managers=[
("objects", django.contrib.admin.models.LogEntryManager()),
Expand Down
2 changes: 1 addition & 1 deletion src/cms/templates/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# and with index_together = ["content_type", "object_id"])
import inspect
exec(inspect.getsource(LogEntry).replace('db_table = "django_admin_log"',
'index_together = ["content_type", "object_id"]')\
'indexes = [models.Index(fields=["content_type", "object_id"])]')\
.replace('class LogEntry','class Log')\
.replace('models.TextField(_("object id"), blank=True, null=True)',
'models.PositiveIntegerField(_("object id"), blank=True, null=True)')) #nosec
Expand Down

0 comments on commit 9b07b68

Please sign in to comment.