mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-22 15:51:19 +00:00
Add comment in product type
This commit is contained in:
parent
cd4b0d8e0c
commit
6113de33ec
19
counter/migrations/0016_producttype_comment.py
Normal file
19
counter/migrations/0016_producttype_comment.py
Normal 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),
|
||||
),
|
||||
]
|
@ -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:
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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 %}
|
||||
|
Loading…
Reference in New Issue
Block a user