Pre-fill allocation count

This commit is contained in:
Oliver Walters 2019-05-18 12:17:57 +10:00
parent 34d1ef7d8d
commit a95e77c429
2 changed files with 8 additions and 1 deletions

View File

@ -25,7 +25,7 @@
Allocated:
</div>
<div class='col-sm-1' id='allocation-panel-{{ item.sub_part.id }}'>
<b><span id='allocation-total-{{ item.sub_part.id }}'>0</span></b>
<b><span id='allocation-total-{{ item.sub_part.id }}'>{% part_allocation_count build item.sub_part %}</span></b>
</div>
<div class='col-sm-2'>
<div class='btn-group' style='float: right;'>

View File

@ -14,6 +14,13 @@ def multiply(x, y, *args, **kwargs):
return x * y
@register.simple_tag()
def part_allocation_count(build, part, *args, **kwargs):
""" Return the total number of <part> allocated to <build> """
return build.getAllocatedQuantity(part)
@register.simple_tag()
def inventree_version(*args, **kwargs):
""" Return InvenTree version string """