Bugfix in item view: Tags can now be rendered
This commit is contained in:
parent
a13a977206
commit
9c9a83cb47
2 changed files with 36 additions and 20 deletions
|
@ -28,4 +28,4 @@ class Item(CanBeContained):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def all_tags(self):
|
def all_tags(self):
|
||||||
return self.tags.all() + self.form_factor.tags.all()
|
return list(self.tags.all()) + list(self.form_factor.tags.all())
|
||||||
|
|
|
@ -22,9 +22,42 @@
|
||||||
<table class="attribute-list">
|
<table class="attribute-list">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Description</th>
|
<th>Name</th>
|
||||||
<td>{{ item }}</td>
|
<td>{{ item.name }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Description</th>
|
||||||
|
<td>{{ item.description }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Tags</th>
|
||||||
|
<td>
|
||||||
|
<ul class="tag-list">
|
||||||
|
{% for tag in item.all_tags %}
|
||||||
|
<li><a href="{% url 'tag-detail' tag.id %}" title="{{ tag.name }}">{{ tag.name }}</a></li>
|
||||||
|
{% empty %}
|
||||||
|
No tags
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{% if item.form_factor %}
|
||||||
|
<tr>
|
||||||
|
<th>Form factor</th>
|
||||||
|
<td>
|
||||||
|
{% if item.form_factor.datasheet %}
|
||||||
|
<a href="{% url 'distributor-detail' item.distributor.id %}">
|
||||||
|
{% if item.form_factor.icon %}<img src="{{ item.form_factor.icon.url }}" class="icon">{% endif %}
|
||||||
|
{{ item.form_factor.name }}
|
||||||
|
</a>
|
||||||
|
{% else %}
|
||||||
|
{% if item.form_factor.icon %}<img src="{{ item.form_factor.icon.url }}" class="icon">{% endif %}
|
||||||
|
{{ item.form_factor.name }}
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if item.manufacturer %}
|
{% if item.manufacturer %}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -48,23 +81,6 @@
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if item.form_factor %}
|
|
||||||
<tr>
|
|
||||||
<th>Form factor</th>
|
|
||||||
<td>
|
|
||||||
{% if item.form_factor.datasheet %}
|
|
||||||
<a href="{% url 'distributor-detail' item.distributor.id %}">
|
|
||||||
{% if item.form_factor.icon %}<img src="{{ item.form_factor.icon.url }}" class="icon">{% endif %}
|
|
||||||
{{ item.form_factor.name }}
|
|
||||||
</a>
|
|
||||||
{% else %}
|
|
||||||
{% if item.form_factor.icon %}<img src="{{ item.form_factor.icon.url }}" class="icon">{% endif %}
|
|
||||||
{{ item.form_factor.name }}
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if item.price %}
|
{% if item.price %}
|
||||||
<tr>
|
<tr>
|
||||||
<th>Price</th>
|
<th>Price</th>
|
||||||
|
|
Loading…
Reference in a new issue