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

Added image field to part

- Images are automatically renamed upon upload
- Part page displays img
This commit is contained in:
Oliver
2018-04-14 17:44:22 +10:00
parent bc7e29aeb4
commit 72b44e15f4
6 changed files with 64 additions and 16 deletions

View File

@@ -4,13 +4,26 @@
{% include "part/cat_link.html" with category=part.category %}
<a href="{% url 'part-detail' part.id %}">{{ part.name }}</a>
<br>
{{ part.description }}
<br>
IPN: {% if part.IPN %}{{ part.IPN }}{% else %}N/A{% endif %}
<br>
<div class="media">
<img class="mr-3"
{% if part.image %}
src="{{ part.image.url }}"
{% else %}
src="/media/part_images/missing.png"
{% endif %}/>
<div class="media-body">
<h5>{{ part.name }}</h5>
{% if part.description %}
<p><i>{{ part.description }}</i></p>
{% endif %}
{% if part.IPN %}
<p><b>IPN:</b> {{ part.IPN }}</p>
{% endif %}
{% if part.URL %}
<p>{% include 'url.html' with url=part.URL %}</p>
{% endif %}
</div>
</div>
{% block details %}

View File

@@ -0,0 +1,7 @@
{% if url %}
<a href="{{ url }}">
{% if text %}{{ text }}
{% else %}{{ url }}
{% endif %}
</a>
{% endif %}