From 25d1b3334f96a0c12b4705f38b67d92cbc1f13f8 Mon Sep 17 00:00:00 2001 From: huamaolin Date: Fri, 7 Aug 2020 10:44:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(OperateLog):=20=E4=BF=AE=E5=A4=8D=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E6=97=A5=E5=BF=97=E6=8C=89=E6=97=B6=E9=97=B4=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=85=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加表OperateLog datetime字段索引 --- apps/audits/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/audits/models.py b/apps/audits/models.py index 97aef40ce..c959bc35c 100644 --- a/apps/audits/models.py +++ b/apps/audits/models.py @@ -58,7 +58,7 @@ class OperateLog(OrgModelMixin): resource_type = models.CharField(max_length=64, verbose_name=_("Resource Type")) resource = models.CharField(max_length=128, verbose_name=_("Resource")) remote_addr = models.CharField(max_length=128, verbose_name=_("Remote addr"), blank=True, null=True) - datetime = models.DateTimeField(auto_now=True, verbose_name=_('Datetime')) + datetime = models.DateTimeField(auto_now=True, verbose_name=_('Datetime'), db_index=True) def __str__(self): return "<{}> {} <{}>".format(self.user, self.action, self.resource)