Add param tab to Part detail view

This commit is contained in:
Oliver Walters 2019-08-20 12:44:00 +10:00
parent 0955166fae
commit 6393ddad53
2 changed files with 8 additions and 0 deletions

View File

@ -971,6 +971,11 @@ class Part(models.Model):
return sum([part.on_order() for part in self.supplier_parts.all().prefetch_related('purchase_order_line_items')])
def get_parameters(self):
""" Return all parameters for this part, ordered by name """
return self.parameters.order_by('name')
def attach_file(instance, filename):
""" Function for storing a file for a PartAttachment

View File

@ -2,6 +2,9 @@
<li{% ifequal tab 'detail' %} class="active"{% endifequal %}>
<a href="{% url 'part-detail' part.id %}">Details</a>
</li>
<li{% ifequal tab 'params' %} class='active'{% endifequal %}>
<a href="{% url 'part-params' part.id %}">Parameters <span class='badge'>{{ part.parameters.count }}</span></a>
</li>
{% if part.is_template %}
<li{% ifequal tab 'variants' %} class='active'{% endifequal %}>
<a href="{% url 'part-variants' part.id %}">Variants <span class='badge'>{{ part.variants.count }}</span></span></a>