Compare commits
2 Commits
462ed0c101
...
871086c7b7
Author | SHA1 | Date | |
---|---|---|---|
871086c7b7 | |||
adf152938d |
@ -276,6 +276,10 @@ class Component(models.Model):
|
||||
|
||||
@property
|
||||
def dynamic_description(self):
|
||||
|
||||
if not self.component_type or not self.component_type.description_template:
|
||||
return ''
|
||||
|
||||
django_engine = engines["django"]
|
||||
template = django_engine.from_string(self.component_type.description_template)
|
||||
|
||||
@ -325,7 +329,7 @@ class AbstractParameter(models.Model):
|
||||
if my_type == 'E' or my_type == 'I':
|
||||
# Engineering float number
|
||||
(num, prefix) = NumConv.number_to_engineering(self.value, it_unit=(True if my_type=='I' else False))
|
||||
result = f'{num:g}'
|
||||
result = f'{round(num, 3):g}'
|
||||
interpostfix = (prefix if prefix else self.parameter_type.interfix or '.')
|
||||
if '.' in result:
|
||||
result = result.replace('.', interpostfix)
|
||||
@ -334,7 +338,7 @@ class AbstractParameter(models.Model):
|
||||
return result
|
||||
elif my_type == 'N':
|
||||
# Standard float number
|
||||
return f'{self.value:g}{self.parameter_type.unit}'
|
||||
return f'{round(self.value, 3):g}{self.parameter_type.unit}'
|
||||
else:
|
||||
return self.resolved_value_as_string()
|
||||
|
||||
|
@ -76,6 +76,11 @@
|
||||
No description available
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if component.dynamic_description %}
|
||||
<h2>Dynamic Description</h2>
|
||||
<pre>{{ component.dynamic_description }}</pre>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-4">
|
||||
{% if component.pref_distri %}
|
||||
|
@ -54,7 +54,12 @@
|
||||
Manufacturer: {{comp.manufacturer}}
|
||||
{% endif %}
|
||||
</div>
|
||||
<span class="badge bg-primary rounded-pill">{{comp.get_total_amount}}</span>
|
||||
<div class="flex-grow-1 d-block ms-3" style="text-align: right;">
|
||||
<pre>{{ comp.dynamic_description }}</pre>
|
||||
</div>
|
||||
<div style="width: 10%; text-align: right;">
|
||||
<span class="badge bg-primary rounded-pill me-2">{{comp.get_total_amount}}</span>
|
||||
</div>
|
||||
</li>
|
||||
</a>
|
||||
{% endfor %}
|
||||
|
@ -56,8 +56,8 @@
|
||||
Responsible: {{ storage.responsible }}
|
||||
</div>
|
||||
<span class="badge ms-1 bg-primary rounded-pill" data-bs-toggle="tooltip" data-bs-placement="top" title="Total number of stored parts">{{storage.get_total_stock_amount}}</span>
|
||||
<span class="badge ms-1 bg-secondary rounded-pill" data-bs-toggle="tooltip" data-bs-placement="top" title="Number of stored lots">{{storage.get_total_stock_count}}</span>
|
||||
<span class="badge ms-1 bg-info rounded-pill" data-bs-toggle="tooltip" data-bs-placement="top" title="Number of substorages">{{storage.get_total_substorage_amount}}</span>
|
||||
<span class="badge ms-1 bg-secondary rounded-pill d-none d-lg-block" data-bs-toggle="tooltip" data-bs-placement="top" title="Number of stored lots">{{storage.get_total_stock_count}}</span>
|
||||
<span class="badge ms-1 bg-info rounded-pill d-none d-lg-block" data-bs-toggle="tooltip" data-bs-placement="top" title="Number of substorages">{{storage.get_total_substorage_amount}}</span>
|
||||
</li>
|
||||
</a>
|
||||
{% endfor %}
|
||||
@ -101,13 +101,13 @@
|
||||
<span class="text-secondary"><br>Lot: {{stock.lot}}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="flex-grow-2 ms-3 d-none d-lg-block" style="text-align: center;">
|
||||
<div class="flex-grow-2 ms-3 d-none d-lg-block" style="text-align: right;">
|
||||
<pre>{{ stock.component.dynamic_description }}</pre>
|
||||
</div>
|
||||
<div class="flex-grow-2 ms-5 d-none d-lg-block">
|
||||
{% qr_from_text stock.get_qr_code size="6" image_format="svg" %}
|
||||
</div>
|
||||
<div class="ms-3">
|
||||
<div class="ms-3" style="width: 20%;">
|
||||
Amount: {{stock.amount}}
|
||||
{% if stock.watermark >= 0 %}
|
||||
<br>Watermark: {{stock.watermark}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user