2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-14 15:41:10 +00:00

Pass column and index data through to each cell in the template

Allows for much more intelligent template rendering
This commit is contained in:
Oliver Walters
2019-07-07 09:50:59 +10:00
parent 0e95fb773f
commit b77bfc74ea
4 changed files with 39 additions and 7 deletions

View File

@@ -76,8 +76,8 @@
<td>{{ forloop.counter }}</td>
{% for item in row.data %}
<td>
<input type='hidden' name='row_{{ row.index }}_col_{{ forloop.counter0 }}' value='{{ item }}'/>
{{ item }}
<input type='hidden' name='row_{{ row.index }}_col_{{ forloop.counter0 }}' value='{{ item.cell }}'/>
{{ item.cell }}
</td>
{% endfor %}
</tr>

View File

@@ -1,5 +1,6 @@
{% extends "part/part_base.html" %}
{% load static %}
{% load inventree_extras %}
{% block details %}
{% include "part/tabs.html" with tab="bom" %}
@@ -23,7 +24,11 @@
<th>Row</th>
{% for col in bom_columns %}
<th>
{% if col.guess %}
{{ col.guess }}
{% else %}
{{ col.name }}
{% endif %}
</th>
{% endfor %}
</tr>
@@ -37,12 +42,15 @@
</button>
</td>
<td>
<input class='numberinput' type='number' min='1' value='{{ row.quantity }}'/>
</td>
<td>{{ forloop.counter }}</td>
<td>{% add row.index 1 %}</td>
{% for item in row.data %}
<td>
{{ item }}
{% if item.column.guess == 'Quantity' %}
<input class='numberinput' type='number' min='1' value='{{ row.quantity }}'/>
{% else %}
{{ item.cell }}
{% endif %}
</td>
{% endfor %}
</tr>