Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove collection field
Marcin Gębalae8e3643703af
diff --git a/saleor/dashboard/product/forms.py b/saleor/dashboard/product/forms.pyindex 1850143660..b887fb6583 100644--- a/saleor/dashboard/product/forms.py+++ b/saleor/dashboard/product/forms.py@@ -55,7 +55,6 @@ class ProductForm(forms.ModelForm):def __init__(self, *args, **kwargs):super(ProductForm, self).__init__(*args, **kwargs)self.fields['name'].widget.attrs['placeholder'] = pgettext_lazy('Product form labels', 'Give your awesome product a name')- self.fields['collection'].widget.attrs['placeholder'] = pgettext_lazy('Product form labels', 'e.g. Zombie apocalypse gear')self.fields['categories'].widget.attrs['data-placeholder'] = pgettext_lazy('Product form labels', 'Search')self.fields['attributes'].widget.attrs['data-placeholder'] = pgettext_lazy('Product form labels', 'Search')diff --git a/saleor/dashboard/templates/dashboard/product/list.html b/saleor/dashboard/templates/dashboard/product/list.htmlindex d96eb9cdb5..0584f975b7 100644--- a/saleor/dashboard/templates/dashboard/product/list.html+++ b/saleor/dashboard/templates/dashboard/product/list.html@@ -37,7 +37,6 @@<a class="title" href="{% url 'dashboard:product-update' pk=product.pk %}"><span class="product-list-name">{{ product.name }}</span></a>- <p class="product-list-name">{{ product.collection }}</p><p class="secondary-content product-list-price">{% gross product.price %}</p><a href="{% url 'dashboard:product-delete' pk=product.pk %}" title="{% trans "Delete product" %}"class="secondary-content materialize-red-text text-lighten-2 product-list-item-delete"><i class="mdi-action-delete"></i></a>diff --git a/saleor/dashboard/templates/dashboard/product/product_confirm_delete.html b/saleor/dashboard/templates/dashboard/product/product_confirm_delete.htmlindex 6ee61888c5..8c8a0b3502 100644--- a/saleor/dashboard/templates/dashboard/product/product_confirm_delete.html+++ b/saleor/dashboard/templates/dashboard/product/product_confirm_delete.html@@ -22,7 +22,6 @@{% else %}<img src="{% static 'placeholders/product-image-placeholder.png' %}" alt="" class="responsive-img">{% endif %}- <p>{{ object.collection }}</p></div></div></div>diff --git a/saleor/dashboard/templates/dashboard/product/product_form.html b/saleor/dashboard/templates/dashboard/product/product_form.htmlindex 6f26ce90d6..6449322820 100644--- a/saleor/dashboard/templates/dashboard/product/product_form.html+++ b/saleor/dashboard/templates/dashboard/product/product_form.html@@ -74,7 +74,6 @@<div class="col l4"><div class="row">{{ product_form.price|materializecss }}{{ product_form.weight|materializecss }}- {{ product_form.collection|materializecss }}{{ product_form.categories|materializecss:"input-field s12" }}{{ product_form.attributes|materializecss:"input-field s12" }}</div>diff --git a/saleor/product/models/base.py b/saleor/product/models/base.pyindex 5901002dff..7694d39f01 100644--- a/saleor/product/models/base.py+++ b/saleor/product/models/base.py@@ -48,7 +48,6 @@ class Product(models.Model, ItemRange):pgettext_lazy('Product field', 'name'), max_length=128)description = models.TextField(verbose_name=pgettext_lazy('Product field', 'description'))- collection = models.CharField(db_index=True, max_length=100, blank=True)categories = models.ManyToManyField(Category, verbose_name=pgettext_lazy('Product field', 'categories'),related_name='products')diff --git a/saleor/product/templates/product/details.html b/saleor/product/templates/product/details.htmlindex 18520f1368..d23fd06f37 100644--- a/saleor/product/templates/product/details.html+++ b/saleor/product/templates/product/details.html@@ -72,23 +72,6 @@{{ product.description|markdown }}</div>- {% if related_products %}- <hr>-- <h4>{% trans "Also in this collection" %}</h4>-- <div class="row product-related">- {% for related in related_products %}- {% if related.id != product.id %}- <a href="{{ related.get_absolute_url }}" class="col-xs-3">- <img src="{{ related.images.first.image.crop.280x280 }}" alt=""- class="thumbnail img-responsive">- </a>- {% endif %}- {% endfor %}- </div>- {% endif %}-</div>{% with images=product.images.all %}diff --git a/saleor/product/views.py b/saleor/product/views.pyindex f7f1f6293d..27ea76403e 100644--- a/saleor/product/views.py+++ b/saleor/product/views.py@@ -11,15 +11,6 @@ from .models import Product, Categoryfrom saleor.cart import Cart-def get_related_products(product):- if not product.collection:- return []- related_products = Product.objects.filter(- collection=product.collection).exclude(id=product.id)- related_products = related_products.prefetch_related('images')- return related_products--def product_details(request, slug, product_id):products = Product.objects.select_subclasses()products = products.prefetch_related('categories')@@ -41,11 +32,9 @@ def product_details(request, slug, product_id):template_name = 'product/details_%s.html' % (type(product).__name__.lower(),)templates = [template_name, 'product/details.html']- related_products = get_related_products(product)return TemplateResponse(request, templates,- {'product': product, 'form': form,- 'related_products': related_products})+ {'product': product, 'form': form})def category_index(request, slug):diff --git a/utils/create_random_data.py b/utils/create_random_data.pyindex 24795a804c..7e5020c85c 100644--- a/utils/create_random_data.py+++ b/utils/create_random_data.py@@ -11,7 +11,6 @@ from saleor.product.models import Categoryfrom saleor.userprofile.models import User, Addressfake = Factory.create()-PRODUCT_COLLECTIONS = fake.words(10)STOCK_LOCATION = 'default'@@ -26,15 +25,9 @@ def get_or_create_category(name, **kwargs):def create_product(**kwargs):- if random.choice([True, False]):- collection = random.choice(PRODUCT_COLLECTIONS)- else:- collection = ''-defaults = {'name': fake.company(),'price': fake.pyfloat(2, 2, positive=True),- 'collection': collection,'weight': fake.random_digit(),'description': '\n\n'.join(fake.paragraphs(5))}@@ -87,7 +80,7 @@ def create_items(placeholder_dir, how_many=10):default_category = get_or_create_category('Default')for i in range(how_many):- product = create_product(collection='')+ product = create_product()product.categories.add(default_category)create_variant(product) # ensure at least one variant