Skip to content

Commit

Permalink
chore: fix some changes for django
Browse files Browse the repository at this point in the history
  • Loading branch information
Ehco1996 committed Aug 25, 2024
1 parent e837951 commit 4099cfb
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 23 deletions.
4 changes: 3 additions & 1 deletion apps/proxy/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
10 changes: 7 additions & 3 deletions apps/sspanel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions apps/tianyi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
tianyi: 天一是三渣的早期作品:<贩罪>的主角,是像猫一样生活的男人,并且善于计算人心/性,做出各种冷静的数据分析
这里存一些数据分析相关的东西
"""

import decimal
from typing import List

Expand Down
3 changes: 2 additions & 1 deletion configs/default/sentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
],
)
30 changes: 15 additions & 15 deletions templates/basehead.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@
type="image/x-icon" />
<!-- css -->
{% if user.theme and user.theme != "default" %}
<link href="https://cdn.jsdelivr.net/npm/[email protected]/{{ user.theme }}/bulmaswatch.min.css"
rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/[email protected]/{{ user.theme }}/bulmaswatch.min.css"
rel="stylesheet" />
{% else %}
<link href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css"
rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css"
rel="stylesheet" />
{% endif %}
<link rel="stylesheet" href="{% static 'sspanel/css/sspanel.css' %}" />
{% if not simple_extra_static or user.is_authenticated %}
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/css/flag-icon.min.css" />
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bulma-extensions.min.css" />
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/fontawesome.min.css" />
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/css/flag-icon.min.css" />
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bulma-extensions.min.css" />
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/fontawesome.min.css" />
{% endif %}
<!-- js -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert.min.js"></script>
<script src="{% static 'sspanel/js/sspanel.js' %}"></script>
{% if not simple_extra_static or user.is_authenticated %}
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/clipboard.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.umd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bulma-extensions.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/js/all.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/clipboard.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.umd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bulma-extensions.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/js/all.min.js"></script>
{% endif %}
6 changes: 3 additions & 3 deletions templates/web/node_occupancy.html
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ <h1 class="title">独享节点</h1>
<td>{{ o.end_time }}</td>
<td>
<progress class="progress {{ o.progress_color }}"
value="{{ o.used_traffic }}"
max="{{ o.total_traffic }}"></progress>{{ o.used_percentage }}{{ o.used_percentage }}
<span>{{ o.human_used_traffic }} / {{ o.human_total_traffic }}</span>
value="{{ o.used_traffic }}"
max="{{ o.total_traffic }}"></progress>{{ o.used_percentage }}{{ o.used_percentage }}
<span>{{ o.human_used_traffic }} / {{ o.human_total_traffic }}</span>
</td>
</tr>
{% endfor %}
Expand Down

0 comments on commit 4099cfb

Please sign in to comment.