Merge branch 'krophil' into 'master'

Add comment in product type

See merge request ae/Sith!126
This commit is contained in:
Skia 2017-11-07 12:10:49 +01:00
commit 4bf805e2f5
4 changed files with 26 additions and 2 deletions

View File

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('counter', '0015_merge'),
]
operations = [
migrations.AddField(
model_name='producttype',
name='comment',
field=models.TextField(verbose_name='comment', blank=True, null=True),
),
]

View File

@ -112,6 +112,7 @@ class ProductType(models.Model):
"""
name = models.CharField(_('name'), max_length=30)
description = models.TextField(_('description'), null=True, blank=True)
comment = models.TextField(_('comment'), null=True, blank=True)
icon = models.ImageField(upload_to='products', null=True, blank=True)
class Meta:

View File

@ -688,7 +688,7 @@ class ProductTypeCreateView(CounterAdminTabsMixin, CounterAdminMixin, CreateView
A create view for the admins
"""
model = ProductType
fields = ['name', 'description', 'icon']
fields = ['name', 'description', 'comment', 'icon']
template_name = 'core/create.jinja'
current_tab = "products"
@ -699,7 +699,7 @@ class ProductTypeEditView(CounterAdminTabsMixin, CounterAdminMixin, UpdateView):
"""
model = ProductType
template_name = 'core/edit.jinja'
fields = ['name', 'description', 'icon']
fields = ['name', 'description', 'comment', 'icon']
pk_url_kwarg = "type_id"
current_tab = "products"

View File

@ -41,6 +41,10 @@
{% for t in categories %}
{% if eboutic.products.filter(product_type=t).exists() %}
<h5>{{ t }}</h5>
{% if t.comment %}
<p>{{ t.comment }}</p>
{% endif %}
<br />
{% for p in eboutic.products.filter(product_type=t).all() %}
{% set file = None %}
{% if p.icon %}