Add pictures to products

This commit is contained in:
Skia
2016-08-21 03:07:15 +02:00
parent a49d9850ab
commit 4cbfd58660
3 changed files with 46 additions and 10 deletions

View File

@ -91,7 +91,14 @@
<h5>{{ t }}</h5>
<div id="cat_{{ t }}">
{% for p in counter.products.filter(product_type=t).all() -%}
{{ add_product(p.id, "<strong>%s</strong><hr>%s €<br>%s" % (p.name, p.selling_price, p.code)) }}
{% set file = None %}
{% if p.icon %}
{% set file = p.icon.url %}
{% else %}
{% set file = static('core/img/na.gif') %}
{% endif %}
{% set prod = '<strong>%s</strong><hr><img src="%s" /><span>%s €<br>%s</span>' % (p.name, file, p.selling_price, p.code) %}
{{ add_product(p.id, prod) }}
{%- endfor %}
</div>
{%- endif -%}