mirror of
				https://github.com/ae-utbm/sith.git
				synced 2025-11-04 11:03:04 +00:00 
			
		
		
		
	Fix form with files
This commit is contained in:
		@@ -6,7 +6,7 @@
 | 
			
		||||
 | 
			
		||||
{% block content %}
 | 
			
		||||
<h2>{% trans name=form.instance.__class__._meta.verbose_name %}Create {{ name }}{% endtrans %}</h2>
 | 
			
		||||
<form action="" method="post">
 | 
			
		||||
<form action="" method="post" enctype="multipart/form-data">
 | 
			
		||||
    {% csrf_token %}
 | 
			
		||||
    {{ form.as_p() }}
 | 
			
		||||
    <p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@
 | 
			
		||||
 | 
			
		||||
{% block content %}
 | 
			
		||||
<h2>{% trans obj=object %}Edit {{ obj }}{% endtrans %}</h2>
 | 
			
		||||
<form action="" method="post">
 | 
			
		||||
<form action="" method="post" enctype="multipart/form-data">
 | 
			
		||||
    {% csrf_token %}
 | 
			
		||||
    {{ form.as_p() }}
 | 
			
		||||
    <p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										19
									
								
								counter/migrations/0006_auto_20160831_1304.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								counter/migrations/0006_auto_20160831_1304.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', '0005_auto_20160826_2330'),
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    operations = [
 | 
			
		||||
        migrations.AlterField(
 | 
			
		||||
            model_name='product',
 | 
			
		||||
            name='buying_groups',
 | 
			
		||||
            field=models.ManyToManyField(related_name='products', verbose_name='buying groups', blank=True, to='core.Group'),
 | 
			
		||||
        ),
 | 
			
		||||
    ]
 | 
			
		||||
@@ -88,7 +88,7 @@ class Product(models.Model):
 | 
			
		||||
    tray = models.BooleanField(_('tray price'), default=False)
 | 
			
		||||
    parent_product = models.ForeignKey('self', related_name='children_products', verbose_name=_("parent product"), null=True,
 | 
			
		||||
            blank=True, on_delete=models.SET_NULL)
 | 
			
		||||
    buying_groups = models.ManyToManyField(Group, related_name='products', verbose_name=_("buying groups"))
 | 
			
		||||
    buying_groups = models.ManyToManyField(Group, related_name='products', verbose_name=_("buying groups"), blank=True)
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        verbose_name = _('product')
 | 
			
		||||
 
 | 
			
		||||
@@ -463,6 +463,7 @@ class ProductListView(CanEditPropMixin, ListView):
 | 
			
		||||
    """
 | 
			
		||||
    model = Product
 | 
			
		||||
    template_name = 'counter/product_list.jinja'
 | 
			
		||||
    ordering = ['name']
 | 
			
		||||
 | 
			
		||||
class ProductEditForm(forms.ModelForm):
 | 
			
		||||
    class Meta:
 | 
			
		||||
@@ -470,7 +471,7 @@ class ProductEditForm(forms.ModelForm):
 | 
			
		||||
        fields = ['name', 'description', 'product_type', 'code', 'parent_product', 'buying_groups', 'purchase_price',
 | 
			
		||||
                'selling_price', 'special_selling_price', 'icon', 'club', 'limit_age', 'tray']
 | 
			
		||||
    parent_product = AutoCompleteSelectField('products', show_help_text=False, label=_("Parent product"), required=False)
 | 
			
		||||
    buying_groups = AutoCompleteSelectMultipleField('groups', show_help_text=False, help_text="", label=_("Buying groups"))
 | 
			
		||||
    buying_groups = AutoCompleteSelectMultipleField('groups', show_help_text=False, help_text="", label=_("Buying groups"), required=False)
 | 
			
		||||
    club = AutoCompleteSelectField('clubs', show_help_text=False)
 | 
			
		||||
    counters = AutoCompleteSelectMultipleField('counters', show_help_text=False, help_text="", label=_("Counters"), required=False)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user