Add comment in product type

This commit is contained in:
Pierre Brunet 2017-10-22 21:10:02 +02:00
parent cd4b0d8e0c
commit 6113de33ec
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) name = models.CharField(_('name'), max_length=30)
description = models.TextField(_('description'), null=True, blank=True) 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) icon = models.ImageField(upload_to='products', null=True, blank=True)
class Meta: class Meta:

View File

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

View File

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