This commit is contained in:
parent
36cd7233b1
commit
5256821b7e
|
@ -119,8 +119,8 @@
|
||||||
<li>
|
<li>
|
||||||
<span class="leftTitle">内存占用</span>
|
<span class="leftTitle">内存占用</span>
|
||||||
<div class="rightPercent">
|
<div class="rightPercent">
|
||||||
<span>{{platform_info.mem_total}}</span>
|
<span>{{platform_info.mem_total|to_g}}</span>
|
||||||
<p style="width:{% present platform_info.mem_used platform_info.mem_total %}%">{{platform_info.mem_used}}</p >
|
<p style="width:{% present platform_info.mem_used platform_info.mem_total %}%">{{platform_info.mem_used|to_g}}</p >
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|
|
@ -6,4 +6,10 @@ register = template.Library()
|
||||||
@register.simple_tag
|
@register.simple_tag
|
||||||
def present(val1, val2):
|
def present(val1, val2):
|
||||||
"""获取两个数的百分比,取整 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