From 4099cfb2365b9f2520b49ae6a9e39b5a3cb5b2bc Mon Sep 17 00:00:00 2001 From: Ehco1996 Date: Sun, 25 Aug 2024 12:09:52 +0800 Subject: [PATCH] chore: fix some changes for django --- apps/proxy/models.py | 4 +++- apps/sspanel/models.py | 10 +++++++--- apps/tianyi.py | 1 + configs/default/sentry.py | 3 ++- templates/basehead.html | 30 +++++++++++++++--------------- templates/web/node_occupancy.html | 6 +++--- 6 files changed, 31 insertions(+), 23 deletions(-) diff --git a/apps/proxy/models.py b/apps/proxy/models.py index 8fdaffd858..0999a64030 100644 --- a/apps/proxy/models.py +++ b/apps/proxy/models.py @@ -803,7 +803,9 @@ class Meta: verbose_name = "用户流量记录" verbose_name_plural = "用户流量记录" ordering = ["-created_at"] - index_together = ["user", "proxy_node", "created_at"] + indexes = [ + models.Index(fields=["user", "proxy_node", "created_at"]), + ] def __str__(self) -> str: return f"用户流量记录:{self.id}" diff --git a/apps/sspanel/models.py b/apps/sspanel/models.py index 58fd8436ce..2e5dec5c70 100644 --- a/apps/sspanel/models.py +++ b/apps/sspanel/models.py @@ -377,7 +377,7 @@ def bind(self, user): self.save() -class UserOrder(models.Model, UserMixin): +class UserOrder(UserMixin, models.Model): ALIPAY_CALLBACK_URL = f"{settings.SITE_HOST}/api/callback/alipay" DEFAULT_ORDER_TIME_OUT = "10m" STATUS_CREATED = 0 @@ -411,7 +411,9 @@ def __str__(self): class Meta: verbose_name = "用户订单" verbose_name_plural = "用户订单" - index_together = ["user", "status"] + indexes = [ + models.Index(fields=["user", "status"]), + ] @classmethod def gen_out_trade_no(cls): @@ -1109,7 +1111,9 @@ class Meta: verbose_name = "工单回复" verbose_name_plural = "工单回复" ordering = ("ticket", "created_at") - index_together = ["ticket", "created_at"] + indexes = [ + models.Index(fields=["ticket", "created_at"]), + ] @classmethod def create_message(cls, user, ticket, message): diff --git a/apps/tianyi.py b/apps/tianyi.py index 484ab20158..24680e864c 100644 --- a/apps/tianyi.py +++ b/apps/tianyi.py @@ -2,6 +2,7 @@ tianyi: 天一是三渣的早期作品:<贩罪>的主角,是像猫一样生活的男人,并且善于计算人心/性,做出各种冷静的数据分析 这里存一些数据分析相关的东西 """ + import decimal from typing import List diff --git a/configs/default/sentry.py b/configs/default/sentry.py index e5f5bb2432..118d629317 100644 --- a/configs/default/sentry.py +++ b/configs/default/sentry.py @@ -16,9 +16,10 @@ release=SENTRY_RELEASE_TAG, traces_sample_rate=SENTRY_TRACES_SAMPLE_RATE, environment=SENTRY_ENVIRONMENT, + auto_session_tracking=False, integrations=[ + RedisIntegration(), CeleryIntegration(), DjangoIntegration(transaction_style="function_name"), - RedisIntegration(), ], ) diff --git a/templates/basehead.html b/templates/basehead.html index 8b03c34bc4..398777cdd6 100644 --- a/templates/basehead.html +++ b/templates/basehead.html @@ -7,29 +7,29 @@ type="image/x-icon" /> {% if user.theme and user.theme != "default" %} - + {% else %} - + {% endif %} {% if not simple_extra_static or user.is_authenticated %} - - - + + + {% endif %} {% if not simple_extra_static or user.is_authenticated %} - - - - - + + + + + {% endif %} diff --git a/templates/web/node_occupancy.html b/templates/web/node_occupancy.html index 98b8b4364b..373600c32a 100644 --- a/templates/web/node_occupancy.html +++ b/templates/web/node_occupancy.html @@ -167,9 +167,9 @@

独享节点

{{ o.end_time }} {{ o.used_percentage }}{{ o.used_percentage }} - {{ o.human_used_traffic }} / {{ o.human_total_traffic }} + value="{{ o.used_traffic }}" + max="{{ o.total_traffic }}">{{ o.used_percentage }}{{ o.used_percentage }} + {{ o.human_used_traffic }} / {{ o.human_total_traffic }} {% endfor %}