mirror of
				https://github.com/ae-utbm/sith.git
				synced 2025-11-04 02:53:06 +00:00 
			
		
		
		
	Add comment in product type
This commit is contained in:
		
							
								
								
									
										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)
 | 
					    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:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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 %}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user