Merge pull request #377 from eReuse/features/3842-prefix-lots-in-device-list
add prefix to lots name in the list of devices
This commit is contained in:
commit
1d48515008
|
@ -653,6 +653,21 @@ class Device(Thing):
|
|||
args[POLYMORPHIC_ON] = cls.type
|
||||
return args
|
||||
|
||||
def get_lots_for_template(self):
|
||||
lots = []
|
||||
for lot in self.lots:
|
||||
if lot.is_incoming:
|
||||
name = "IN - " + lot.name
|
||||
lots.append(name)
|
||||
if lot.is_outgoing:
|
||||
name = "OUT - " + lot.name
|
||||
lots.append(name)
|
||||
if lot.is_temporary:
|
||||
name = "TEMP - " + lot.name
|
||||
lots.append(name)
|
||||
lots.sort()
|
||||
return lots
|
||||
|
||||
def phid(self):
|
||||
if self.placeholder:
|
||||
return self.placeholder.phid
|
||||
|
|
|
@ -376,8 +376,8 @@
|
|||
</a>
|
||||
{% if dev.lots | length > 0 %}
|
||||
<h6 class="d-inline">
|
||||
{% for lot in dev.lots %}
|
||||
<span class="badge rounded-pill bg-light text-dark">{{ lot.name }}</span>
|
||||
{% for lot in dev.get_lots_for_template() %}
|
||||
<span class="badge rounded-pill bg-light text-dark">{{ lot }}</span>
|
||||
{% endfor %}
|
||||
</h6>
|
||||
{% endif %}
|
||||
|
|
Reference in New Issue