This commit is contained in:
parent
36cd7233b1
commit
5256821b7e
|
@ -119,8 +119,8 @@
|
|||
<li>
|
||||
<span class="leftTitle">内存占用</span>
|
||||
<div class="rightPercent">
|
||||
<span>{{platform_info.mem_total}}</span>
|
||||
<p style="width:{% present platform_info.mem_used platform_info.mem_total %}%">{{platform_info.mem_used}}</p >
|
||||
<span>{{platform_info.mem_total|to_g}}</span>
|
||||
<p style="width:{% present platform_info.mem_used platform_info.mem_total %}%">{{platform_info.mem_used|to_g}}</p >
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -6,4 +6,10 @@ register = template.Library()
|
|||
@register.simple_tag
|
||||
def present(val1, val2):
|
||||
"""获取两个数的百分比,取整 val1 / val2 """
|
||||
return int(int(val1) * 100 / int(val2))
|
||||
return int(int(val1) * 100 / int(val2))
|
||||
|
||||
|
||||
@register.filter
|
||||
def to_g(val):
|
||||
"""字节到G"""
|
||||
return int(int(val)/1024/1024)
|
Loading…
Reference in New Issue