Commit 37d30363 authored by Skia's avatar Skia
Browse files

Fix form with files

parent a47cca1b
Pipeline #164 failed with stage
in 2 minutes and 16 seconds
......@@ -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>
......
# -*- 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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment