From 94da5af24f34173b89c329d1af7e25d8e22ecb64 Mon Sep 17 00:00:00 2001 From: ngfchl Date: Sun, 18 Sep 2022 19:29:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B4=A7=E6=80=A5=E4=BF=AE=E5=A4=8D=E6=96=B0?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pt_site/admin.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pt_site/admin.py b/pt_site/admin.py index c420ca7..35317ed 100644 --- a/pt_site/admin.py +++ b/pt_site/admin.py @@ -349,21 +349,20 @@ class MySiteAdmin(ImportExportModelAdmin): # instead of ModelAdmin def sign_in_state(self, obj: MySite): template = """
- + {} {}
""" signin_today = obj.signin_set.filter(created_at__date__gte=datetime.today()).first() if not obj.site.sign_in_support: - sign_template = format_html('无需') + sign_template = '无需' else: - sign_template = format_html('', - 'yes' if signin_today and signin_today.sign_in_today else 'no') + sign_template = ''.format( + 'yes' if signin_today and signin_today.sign_in_today else 'no' + ) if obj.mail == 0: - return sign_template - return template.format(sign_template, obj.mail) + return format_html(sign_template) + return format_html(template.format(sign_template, obj.mail)) sign_in_state.short_description = '今日签到'