From e9c65ef6eb6224c8528f6aebb6cda9ab37000292 Mon Sep 17 00:00:00 2001 From: ngfchl Date: Thu, 19 Jan 2023 17:08:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E6=9B=B4=E6=96=B0=E5=90=8E=E6=88=91=E7=9A=84=E7=AB=99?= =?UTF-8?q?=E7=82=B9=E9=A1=B5=E9=9D=A2=E6=97=A0=E6=B3=95=E6=89=93=E5=BC=80?= =?UTF-8?q?=E7=9A=84=E9=94=99=E8=AF=AF=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pt_site/admin.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pt_site/admin.py b/pt_site/admin.py index 07d5f9c..9d5153d 100644 --- a/pt_site/admin.py +++ b/pt_site/admin.py @@ -308,23 +308,22 @@ class MySiteAdmin(AjaxAdmin): # instead of ModelAdmin '魔力:{}
' '满魔:{} ' '积分/HP:{}', - round(float(obj.sitestatus_set.order_by('id').first().sp_hour), 3) if obj.sitestatus_set.order_by( - 'id').first().sp_hour else 0, + round(float(status_today.sp_hour), 3) if status_today else 0, status_today.my_sp if status_today else 0, - '{:.2%}'.format(float(obj.sitestatus_set.order_by( - 'id').first().sp_hour) / obj.site.sp_full) if status_today and obj.site.sp_full != 0 else 0, + '{:.2%}'.format(float(status_today.sp_hour) / obj.site.sp_full) if status_today and obj.site.sp_full != 0 else 0, status_today.my_bonus if status_today else 0 ) bonus.short_description = '魔力' def userinfo(self, obj: MySite): + status = obj.sitestatus_set.order_by('id').first() return format_html( '等级:{} / ' '邀请:{}
' 'H&R:{}', obj.my_level, - obj.sitestatus_set.order_by('id').first().invitation, + status.invitation if status else 0, obj.my_hr if obj.my_hr else 0 ) @@ -345,8 +344,8 @@ class MySiteAdmin(AjaxAdmin): # instead of ModelAdmin return format_html( '做种:{} / 下载:{}
' ' 做种体积:{}', - status_today.seed, - status_today.leech, + status_today.seed if status_today else 0, + status_today.leech if status_today else 0, FileSizeConvert.parse_2_file_size(status_today.seed_vol) if status_today else 0, )