Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Rename ProductAttribtue to Attribute
Pacu2ba116a3d13a1
diff --git a/saleor/core/utils/random_data.py b/saleor/core/utils/random_data.pyindex ca898d3945..e175f7c7ff 100644--- a/saleor/core/utils/random_data.py+++ b/saleor/core/utils/random_data.py@@ -29,7 +29,7 @@ from ...order.models import Fulfillment, Order, Paymentfrom ...order.utils import update_order_statusfrom ...page.models import Pagefrom ...product.models import (- AttributeValue, Category, Collection, Product, ProductAttribute,+ AttributeValue, Category, Collection, Product, Attribute,ProductImage, ProductType, ProductVariant)from ...product.thumbnails import create_product_thumbnailsfrom ...product.utils.attributes import get_name_from_attributes@@ -159,9 +159,9 @@ def create_product_types_by_schema(root_schema):def set_product_attributes(product, product_type):attr_dict = {}- for product_attribute in product_type.product_attributes.all():- value = random.choice(product_attribute.values.all())- attr_dict[str(product_attribute.pk)] = str(value.pk)+ for attribute in product_type.product_attributes.all():+ value = random.choice(attribute.values.all())+ attr_dict[str(attribute.pk)] = str(value.pk)product.attributes = attr_dictproduct.save(update_fields=['attributes'])@@ -332,7 +332,7 @@ def create_attribute(**kwargs):'slug': slug,'name': slug.title()}defaults.update(kwargs)- attribute = ProductAttribute.objects.get_or_create(**defaults)[0]+ attribute = Attribute.objects.get_or_create(**defaults)[0]return attributediff --git a/saleor/dashboard/product/filters.py b/saleor/dashboard/product/filters.pyindex 00a9ffc581..a6ec664ad1 100644--- a/saleor/dashboard/product/filters.py+++ b/saleor/dashboard/product/filters.py@@ -5,7 +5,7 @@ from django_filters import (RangeFilter)from ...core.filters import SortedFilterSet-from ...product.models import Category, Product, ProductAttribute, ProductType+from ...product.models import Category, Product, Attribute, ProductTypefrom ..widgets import MoneyRangeWidgetPRODUCT_SORT_BY_FIELDS = {@@ -62,7 +62,7 @@ class ProductFilter(SortedFilterSet):number=counter) % {'counter': counter}-class ProductAttributeFilter(SortedFilterSet):+class AttributeFilter(SortedFilterSet):name = CharFilter(label=pgettext_lazy('Product attribute list filter label', 'Name'),lookup_expr='icontains')@@ -72,7 +72,7 @@ class ProductAttributeFilter(SortedFilterSet):field_labels=PRODUCT_TYPE_SORT_BY_FIELDS)class Meta:- model = ProductAttribute+ model = Attributefields = []def get_summary_message(self):@@ -97,12 +97,12 @@ class ProductTypeFilter(SortedFilterSet):label=pgettext_lazy('Product type list filter label', 'Product attributes'),field_name='product_attributes',- queryset=ProductAttribute.objects.all())+ queryset=Attribute.objects.all())variant_attributes = ModelMultipleChoiceFilter(label=pgettext_lazy('Product type list filter label', 'Variant attributes'),field_name='variant_attributes',- queryset=ProductAttribute.objects.all())+ queryset=Attribute.objects.all())class Meta:model = ProductTypediff --git a/saleor/dashboard/product/forms.py b/saleor/dashboard/product/forms.pyindex a416c2feff..4b978257fe 100644--- a/saleor/dashboard/product/forms.py+++ b/saleor/dashboard/product/forms.py@@ -15,7 +15,7 @@ from ...core import TaxRateTypefrom ...core.utils.taxes import DEFAULT_TAX_RATE_NAME, include_taxes_in_pricesfrom ...core.weight import WeightField, get_default_weight_unitfrom ...product.models import (- AttributeValue, Category, Collection, Product, ProductAttribute,+ AttributeValue, Category, Collection, Product, Attribute,ProductImage, ProductType, ProductVariant, VariantImage)from ...product.thumbnails import create_product_thumbnailsfrom ...product.utils.attributes import get_name_from_attributes@@ -160,7 +160,7 @@ class ProductTypeForm(forms.ModelForm):class AttributesMixin(object):"""Form mixin that dynamically adds attribute fields."""- available_attributes = ProductAttribute.objects.none()+ available_attributes = Attribute.objects.none()# Name of a field in self.instance that hold attributes HStoremodel_attributes_field = None@@ -419,9 +419,9 @@ class VariantImagesSelectForm(forms.Form):VariantImage.objects.bulk_create(images)-class ProductAttributeForm(forms.ModelForm):+class AttributeForm(forms.ModelForm):class Meta:- model = ProductAttribute+ model = Attributeexclude = []labels = {'name': pgettext_lazy(@@ -449,7 +449,7 @@ class ReorderAttributeValuesForm(forms.ModelForm):queryset=AttributeValue.objects.none())class Meta:- model = ProductAttribute+ model = Attributefields = ()def __init__(self, *args, **kwargs):diff --git a/saleor/dashboard/product/urls.py b/saleor/dashboard/product/urls.pyindex f63a07c3e3..334e235a8d 100644--- a/saleor/dashboard/product/urls.py+++ b/saleor/dashboard/product/urls.py@@ -58,24 +58,24 @@ urlpatterns = [views.ajax_upload_image, name='product-images-upload'),url(r'attributes/$',- views.attribute_list, name='product-attributes'),+ views.attribute_list, name='attributes'),url(r'attributes/(?P<pk>[0-9]+)/$',- views.attribute_details, name='product-attribute-details'),+ views.attribute_details, name='attribute-details'),url(r'attributes/add/$',- views.attribute_create, name='product-attribute-add'),+ views.attribute_create, name='attribute-add'),url(r'attributes/(?P<pk>[0-9]+)/update/$',- views.attribute_edit, name='product-attribute-update'),+ views.attribute_edit, name='attribute-update'),url(r'attributes/(?P<pk>[0-9]+)/delete/$',- views.attribute_delete, name='product-attribute-delete'),+ views.attribute_delete, name='attribute-delete'),url(r'attributes/(?P<attribute_pk>[0-9]+)/value/add/$',views.attribute_value_create,- name='product-attribute-value-add'),+ name='attribute-value-add'),url(r'attributes/(?P<attribute_pk>[0-9]+)/value/(?P<value_pk>[0-9]+)/update/$', # noqaviews.attribute_value_edit,- name='product-attribute-value-update'),+ name='attribute-value-update'),url(r'attributes/(?P<attribute_pk>[0-9]+)/value/(?P<value_pk>[0-9]+)/delete/$', # noqaviews.attribute_value_delete,- name='product-attribute-value-delete'),+ name='attribute-value-delete'),url(r'attributes/(?P<attribute_pk>[0-9]+)/values/reorder/$',views.ajax_reorder_attribute_values,- name='product-attribute-values-reorder')]+ name='attribute-values-reorder')]diff --git a/saleor/dashboard/product/views.py b/saleor/dashboard/product/views.pyindex 4705edc649..119be62d06 100644--- a/saleor/dashboard/product/views.py+++ b/saleor/dashboard/product/views.py@@ -14,13 +14,13 @@ from . import formsfrom ...core.utils import get_paginator_itemsfrom ...discount.models import Salefrom ...product.models import (- AttributeValue, Product, ProductAttribute, ProductImage, ProductType,+ AttributeValue, Product, Attribute, ProductImage, ProductType,ProductVariant)from ...product.utils.availability import get_availabilityfrom ...product.utils.costs import (get_margin_for_variant, get_product_costs_data)from ..views import staff_member_required-from .filters import ProductAttributeFilter, ProductFilter, ProductTypeFilter+from .filters import AttributeFilter, ProductFilter, ProductTypeFilter@staff_member_required@@ -532,9 +532,9 @@ def ajax_upload_image(request, product_pk):@staff_member_required@permission_required('product.manage_products')def attribute_list(request):- attributes = (ProductAttribute.objects.prefetch_related('values')+ attributes = (Attribute.objects.prefetch_related('values').order_by('name'))- attribute_filter = ProductAttributeFilter(request.GET, queryset=attributes)+ attribute_filter = AttributeFilter(request.GET, queryset=attributes)attributes = [(attribute.pk, attribute.name, attribute.values.all())for attribute in attribute_filter.qs]@@ -544,67 +544,67 @@ def attribute_list(request):'attributes': attributes, 'filter_set': attribute_filter,'is_empty': not attribute_filter.queryset.exists()}return TemplateResponse(- request, 'dashboard/product/product_attribute/list.html', ctx)+ request, 'dashboard/product/attribute/list.html', ctx)@staff_member_required@permission_required('product.manage_products')def attribute_details(request, pk):- attributes = ProductAttribute.objects.prefetch_related('values').all()+ attributes = Attribute.objects.prefetch_related('values').all()attribute = get_object_or_404(attributes, pk=pk)values = attribute.values.all()ctx = {'attribute': attribute, 'values': values}return TemplateResponse(- request, 'dashboard/product/product_attribute/detail.html', ctx)+ request, 'dashboard/product/attribute/detail.html', ctx)@staff_member_required@permission_required('product.manage_products')def attribute_create(request):- attribute = ProductAttribute()- form = forms.ProductAttributeForm(request.POST or None, instance=attribute)+ attribute = Attribute()+ form = forms.AttributeForm(request.POST or None, instance=attribute)if form.is_valid():attribute = form.save()msg = pgettext_lazy('Dashboard message', 'Added attribute')messages.success(request, msg)- return redirect('dashboard:product-attribute-details', pk=attribute.pk)+ return redirect('dashboard:attribute-details', pk=attribute.pk)ctx = {'attribute': attribute, 'form': form}return TemplateResponse(request,- 'dashboard/product/product_attribute/form.html',+ 'dashboard/product/attribute/form.html',ctx)@staff_member_required@permission_required('product.manage_products')def attribute_edit(request, pk):- attribute = get_object_or_404(ProductAttribute, pk=pk)- form = forms.ProductAttributeForm(request.POST or None, instance=attribute)+ attribute = get_object_or_404(Attribute, pk=pk)+ form = forms.AttributeForm(request.POST or None, instance=attribute)if form.is_valid():attribute = form.save()msg = pgettext_lazy('Dashboard message', 'Updated attribute')messages.success(request, msg)- return redirect('dashboard:product-attribute-details', pk=attribute.pk)+ return redirect('dashboard:attribute-details', pk=attribute.pk)ctx = {'attribute': attribute, 'form': form}return TemplateResponse(request,- 'dashboard/product/product_attribute/form.html',+ 'dashboard/product/attribute/form.html',ctx)@staff_member_required@permission_required('product.manage_products')def attribute_delete(request, pk):- attribute = get_object_or_404(ProductAttribute, pk=pk)+ attribute = get_object_or_404(Attribute, pk=pk)if request.method == 'POST':attribute.delete()msg = pgettext_lazy('Dashboard message', 'Removed attribute %s') % (attribute.name,)messages.success(request, msg)- return redirect('dashboard:product-attributes')+ return redirect('dashboard:attributes')return TemplateResponse(request,- 'dashboard/product/product_attribute/modal/'+ 'dashboard/product/attribute/modal/''attribute_confirm_delete.html',{'attribute': attribute})@@ -612,7 +612,7 @@ def attribute_delete(request, pk):@staff_member_required@permission_required('product.manage_products')def attribute_value_create(request, attribute_pk):- attribute = get_object_or_404(ProductAttribute, pk=attribute_pk)+ attribute = get_object_or_404(Attribute, pk=attribute_pk)value = AttributeValue(attribute_id=attribute_pk)form = forms.AttributeValueForm(request.POST or None, instance=value)if form.is_valid():@@ -620,18 +620,18 @@ def attribute_value_create(request, attribute_pk):msg = pgettext_lazy('Dashboard message', 'Added attribute\'s value')messages.success(request, msg)- return redirect('dashboard:product-attribute-details', pk=attribute_pk)+ return redirect('dashboard:attribute-details', pk=attribute_pk)ctx = {'attribute': attribute, 'value': value, 'form': form}return TemplateResponse(request,- 'dashboard/product/product_attribute/values/form.html',+ 'dashboard/product/attribute/values/form.html',ctx)@staff_member_required@permission_required('product.manage_products')def attribute_value_edit(request, attribute_pk, value_pk):- attribute = get_object_or_404(ProductAttribute, pk=attribute_pk)+ attribute = get_object_or_404(Attribute, pk=attribute_pk)value = get_object_or_404(AttributeValue, pk=value_pk)form = forms.AttributeValueForm(request.POST or None, instance=value)if form.is_valid():@@ -639,11 +639,11 @@ def attribute_value_edit(request, attribute_pk, value_pk):msg = pgettext_lazy('Dashboard message', 'Updated attribute\'s value')messages.success(request, msg)- return redirect('dashboard:product-attribute-details', pk=attribute_pk)+ return redirect('dashboard:attribute-details', pk=attribute_pk)ctx = {'attribute': attribute, 'value': value, 'form': form}return TemplateResponse(request,- 'dashboard/product/product_attribute/values/form.html',+ 'dashboard/product/attribute/values/form.html',ctx)@@ -657,17 +657,17 @@ def attribute_value_delete(request, attribute_pk, value_pk):'Dashboard message','Removed attribute\'s value %s') % (value.name,)messages.success(request, msg)- return redirect('dashboard:product-attribute-details', pk=attribute_pk)+ return redirect('dashboard:attribute-details', pk=attribute_pk)return TemplateResponse(request,- 'dashboard/product/product_attribute/values/modal/confirm_delete.html',+ 'dashboard/product/attribute/values/modal/confirm_delete.html',{'value': value, 'attribute_pk': attribute_pk})@staff_member_required@permission_required('product.manage_products')def ajax_reorder_attribute_values(request, attribute_pk):- attribute = get_object_or_404(ProductAttribute, pk=attribute_pk)+ attribute = get_object_or_404(Attribute, pk=attribute_pk)form = forms.ReorderAttributeValuesForm(request.POST, instance=attribute)status = 200diff --git a/saleor/data_feeds/google_merchant.py b/saleor/data_feeds/google_merchant.pyindex fa01acace5..70c10991dd 100644--- a/saleor/data_feeds/google_merchant.py+++ b/saleor/data_feeds/google_merchant.py@@ -10,7 +10,7 @@ from django.utils.encoding import smart_textfrom ..discount.models import Salefrom ..product.models import (- AttributeValue, Category, ProductAttribute, ProductVariant)+ AttributeValue, Category, Attribute, ProductVariant)CATEGORY_SEPARATOR = ' > '@@ -198,7 +198,7 @@ def write_feed(file_obj):categories = Category.objects.all()discounts = Sale.objects.active(date.today()).prefetch_related('products', 'categories')- attributes_dict = {a.slug: a.pk for a in ProductAttribute.objects.all()}+ attributes_dict = {a.slug: a.pk for a in Attribute.objects.all()}attribute_values_dict = {smart_text(a.pk): smart_text(a) for ain AttributeValue.objects.all()}category_paths = {}diff --git a/saleor/graphql/api.py b/saleor/graphql/api.pyindex 9b26c26ac7..a8a4fb0b19 100644--- a/saleor/graphql/api.py+++ b/saleor/graphql/api.py@@ -41,8 +41,8 @@ from .page.mutations import PageCreate, PageDelete, PageUpdatefrom .product.filters import ProductFilterSetfrom .product.mutations.attributes import (AttributeValueCreate, AttributeValueDelete,- AttributeValueUpdate, ProductAttributeCreate, ProductAttributeDelete,- ProductAttributeUpdate)+ AttributeValueUpdate, AttributeCreate, AttributeDelete,+ AttributeUpdate)from .product.mutations.products import (CategoryCreate, CategoryDelete, CategoryUpdate,CollectionAddProducts, CollectionCreate, CollectionDelete,@@ -56,7 +56,7 @@ from .product.resolvers import (resolve_attributes, resolve_categories, resolve_collections,resolve_products, resolve_product_types, resolve_product_variants)from .product.types import (- Category, Collection, Product, ProductAttribute, ProductType,+ Category, Collection, Product, Attribute, ProductType,ProductVariant)from .shipping.resolvers import resolve_shipping_zonesfrom .shipping.types import ShippingZone@@ -74,7 +74,7 @@ class Query(graphene.ObjectType):AddressValidationData,input=graphene.Argument(AddressValidationInput, required=True))attributes = DjangoFilterConnectionField(- ProductAttribute,+ Attribute,query=graphene.String(description=DESCRIPTIONS['attributes']),in_category=graphene.Argument(graphene.ID),description='List of the shop\'s product attributes.')@@ -336,9 +336,9 @@ class Mutations(graphene.ObjectType):page_delete = PageDelete.Field()page_update = PageUpdate.Field()- product_attribute_create = ProductAttributeCreate.Field()- product_attribute_delete = ProductAttributeDelete.Field()- product_attribute_update = ProductAttributeUpdate.Field()+ attribute_create = AttributeCreate.Field()+ attribute_delete = AttributeDelete.Field()+ attribute_update = AttributeUpdate.Field()product_create = ProductCreate.Field()product_delete = ProductDelete.Field()diff --git a/saleor/graphql/product/filters.py b/saleor/graphql/product/filters.pyindex 74267ad7b7..7c124264a9 100644--- a/saleor/graphql/product/filters.py+++ b/saleor/graphql/product/filters.py@@ -8,11 +8,11 @@ from django_filters.fields import Lookupfrom graphene_django.filter.filterset import Filter, FilterSetfrom ...product.filters import SORT_BY_FIELDS-from ...product.models import Product, ProductAttribute+from ...product.models import Product, Attributefrom .fields import AttributeField-class ProductAttributeFilter(Filter):+class AttributeFilter(Filter):field_class = AttributeFielddef filter(self, qs, value):@@ -22,7 +22,7 @@ class ProductAttributeFilter(Filter):if not value:return qs.distinct() if self.distinct else qs- attributes = ProductAttribute.objects.prefetch_related('values')+ attributes = Attribute.objects.prefetch_related('values')attributes_map = {attribute.slug: attribute.pk for attribute in attributes}values_map = {@@ -67,7 +67,7 @@ class ProductFilterSet(FilterSet):@classmethoddef filter_for_field(cls, f, field_name, lookup_expr='exact'):if field_name == 'attributes':- return ProductAttributeFilter(+ return AttributeFilter(field_name=field_name, lookup_expr=lookup_expr, distinct=True)# this class method is called during class construction so we can't# reference ProductFilterSet here yetdiff --git a/saleor/graphql/product/mutations/attributes.py b/saleor/graphql/product/mutations/attributes.pyindex 8525645686..e024279307 100644--- a/saleor/graphql/product/mutations/attributes.py+++ b/saleor/graphql/product/mutations/attributes.py@@ -4,7 +4,7 @@ from ....product import modelsfrom ...core.mutations import ModelDeleteMutation, ModelMutation-class ProductAttributesInput(graphene.InputObjectType):+class AttributesInput(graphene.InputObjectType):slug = graphene.String(required=True, description='Internal name.')name = graphene.String(@@ -31,42 +31,42 @@ class AttributeValueUpdateInput(graphene.InputObjectType):required=True, description='Name displayed in the interface.')-class ProductAttributeCreate(ModelMutation):+class AttributeCreate(ModelMutation):class Arguments:- input = ProductAttributesInput(+ input = AttributesInput(required=True,description='Fields required to create a product attribute.')class Meta:description = 'Creates a product attribute.'- model = models.ProductAttribute+ model = models.Attribute@classmethoddef user_is_allowed(cls, user, input):return user.has_perm('product.manage_products')-class ProductAttributeUpdate(ProductAttributeCreate):+class AttributeUpdate(AttributeCreate):class Arguments:id = graphene.ID(required=True, description='ID of a product attribute to update.')- input = ProductAttributesInput(+ input = AttributesInput(required=True,description='Fields required to update a product attribute.')class Meta:description = 'Updates a product attribute.'- model = models.ProductAttribute+ model = models.Attribute-class ProductAttributeDelete(ModelDeleteMutation):+class AttributeDelete(ModelDeleteMutation):class Arguments:id = graphene.ID(required=True, description='ID of a product attribute to delete.')class Meta:description = 'Deletes a product attribute.'- model = models.ProductAttribute+ model = models.Attribute@classmethoddef user_is_allowed(cls, user, input):diff --git a/saleor/graphql/product/resolvers.py b/saleor/graphql/product/resolvers.pyindex 4c69f5d84e..9490f19fe9 100644--- a/saleor/graphql/product/resolvers.py+++ b/saleor/graphql/product/resolvers.py@@ -13,7 +13,7 @@ ATTRIBUTES_SEARCH_FIELDS = ('name', 'slug')def resolve_attributes(info, category_id, query):- queryset = models.ProductAttribute.objects.prefetch_related('values')+ queryset = models.Attribute.objects.prefetch_related('values')queryset = filter_by_query_param(queryset, query, ATTRIBUTES_SEARCH_FIELDS)if category_id:# Get attributes that are used with product typesdiff --git a/saleor/graphql/product/types.py b/saleor/graphql/product/types.pyindex 33f844aefc..1a96f24c61 100644--- a/saleor/graphql/product/types.py+++ b/saleor/graphql/product/types.py@@ -22,7 +22,7 @@ COLOR_PATTERN = r'^(#[0-9a-fA-F]{3}|#(?:[0-9a-fA-F]{2}){2,4}|(rgb|hsl)a?\((-?\d+color_pattern = re.compile(COLOR_PATTERN)-class ProductAttributeValueType(graphene.Enum):+class AttributeValueType(graphene.Enum):COLOR = 'COLOR'GRADIENT = 'GRADIENT'URL = 'URL'@@ -34,7 +34,7 @@ def resolve_attribute_list(attributes):values = list(attributes.values())attributes_map = {- att.pk: att for att in models.ProductAttribute.objects.filter(+ att.pk: att for att in models.Attribute.objects.filter(pk__in=keys)}values_map = {val.pk: val for val in models.AttributeValue.objects.filter(@@ -49,19 +49,19 @@ def resolve_attribute_list(attributes):def resolve_attribute_value_type(attribute_value):if color_pattern.match(attribute_value):- return ProductAttributeValueType.COLOR+ return AttributeValueType.COLORif 'gradient(' in attribute_value:- return ProductAttributeValueType.GRADIENT+ return AttributeValueType.GRADIENTif '://' in attribute_value:- return ProductAttributeValueType.URL- return ProductAttributeValueType.STRING+ return AttributeValueType.URL+ return AttributeValueType.STRING-class ProductAttributeValue(CountableDjangoObjectType):+class AttributeValue(CountableDjangoObjectType):name = graphene.String(description='Visible name for display purposes.')slug = graphene.String(description='Internal representation of an attribute name.')- type = ProductAttributeValueType(description='Type of value.')+ type = AttributeValueType(description='Type of value.')class Meta:description = 'Represents a value of an attribute.'@@ -73,12 +73,12 @@ class ProductAttributeValue(CountableDjangoObjectType):return resolve_attribute_value_type(self.value)-class ProductAttribute(CountableDjangoObjectType):+class Attribute(CountableDjangoObjectType):name = graphene.String(description='Visible name for display purposes.')slug = graphene.String(description='Internal representation of an attribute name.')values = graphene.List(- ProductAttributeValue, description='List of attribute\'s values.')+ AttributeValue, description='List of attribute\'s values.')class Meta:description = """Custom attribute of a product. Attributes can be@@ -86,7 +86,7 @@ class ProductAttribute(CountableDjangoObjectType):exclude_fields = ['product_types', 'product_variant_types']interfaces = [relay.Node]filter_fields = ['id', 'slug']- model = models.ProductAttribute+ model = models.Attributedef resolve_values(self, info):return self.values.all()@@ -99,10 +99,10 @@ class Margin(graphene.ObjectType):class SelectedAttribute(graphene.ObjectType):attribute = graphene.Field(- ProductAttribute,+ Attribute,default_value=None, description='Name of an attribute')value = graphene.Field(- ProductAttributeValue,+ AttributeValue,default_value=None, description='Value of an attribute.')class Meta:diff --git a/saleor/graphql/product/utils.py b/saleor/graphql/product/utils.pyindex af3819d4b6..1ad055cfd7 100644--- a/saleor/graphql/product/utils.py+++ b/saleor/graphql/product/utils.py@@ -1,7 +1,7 @@from django.utils.text import slugifyfrom ...product.models import (- AttributeValue, ProductAttribute, ProductVariant)+ AttributeValue, Attribute, ProductVariant)from ...product.utils.attributes import get_name_from_attributes@@ -35,7 +35,7 @@ def attributes_to_hstore(attribute_value_input, attributes_queryset):if value_id is None:# `value_id` was not found; create a new AttributeValue# instance from the provided `value`.- attr_instance = ProductAttribute.objects.get(slug=attr_slug)+ attr_instance = Attribute.objects.get(slug=attr_slug)obj = attr_instance.values.get_or_create(name=value, slug=slugify(value))[0]value_id = obj.pkdiff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex c66eea2b63..76a1250535 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -357,12 +357,12 @@ type AssignNavigation {type AttributeValueCreate {errors: [Error]- attributeValue: ProductAttributeValue+ attributeValue: AttributeValue}type AttributeValueDelete {errors: [Error]- attributeValue: ProductAttributeValue+ attributeValue: AttributeValue}input AttributeValueInput {@@ -374,7 +374,7 @@ input AttributeValueInput {type AttributeValueUpdate {errors: [Error]- attributeValue: ProductAttributeValue+ attributeValue: AttributeValue}input AttributeValueUpdateInput {@@ -867,9 +867,9 @@ type Mutations {pageCreate(input: PageInput!): PageCreatepageDelete(id: ID!): PageDeletepageUpdate(id: ID!, input: PageInput!): PageUpdate- productAttributeCreate(input: ProductAttributesInput!): ProductAttributeCreate- productAttributeDelete(id: ID!): ProductAttributeDelete- productAttributeUpdate(id: ID!, input: ProductAttributesInput!): ProductAttributeUpdate+ productAttributeCreate(input: AttributesInput!): AttributeCreate+ productAttributeDelete(id: ID!): AttributeDelete+ productAttributeUpdate(id: ID!, input: AttributesInput!): AttributeUpdateproductCreate(input: ProductCreateInput!): ProductCreateproductDelete(id: ID!): ProductDeleteproductUpdate(id: ID!, input: ProductInput!): ProductUpdate@@ -1200,56 +1200,56 @@ type Product implements Node {imageById(id: ID): ProductImage}-type ProductAttribute implements Node {+type Attribute implements Node {id: ID!slug: Stringname: String- values: [ProductAttributeValue]+ values: [AttributeValue]}-type ProductAttributeCountableConnection {+type AttributeCountableConnection {pageInfo: PageInfo!- edges: [ProductAttributeCountableEdge!]!+ edges: [AttributeCountableEdge!]!totalCount: Int}-type ProductAttributeCountableEdge {- node: ProductAttribute!+type AttributeCountableEdge {+ node: Attribute!cursor: String!}-type ProductAttributeCreate {+type AttributeCreate {errors: [Error]- productAttribute: ProductAttribute+ productAttribute: Attribute}-type ProductAttributeDelete {+type AttributeDelete {errors: [Error]- productAttribute: ProductAttribute+ productAttribute: Attribute}-type ProductAttributeUpdate {+type AttributeUpdate {errors: [Error]- productAttribute: ProductAttribute+ productAttribute: Attribute}-type ProductAttributeValue implements Node {+type AttributeValue implements Node {id: ID!sortOrder: Int!name: Stringvalue: String!slug: String- type: ProductAttributeValueType+ type: AttributeValueType}-enum ProductAttributeValueType {+enum AttributeValueType {COLORGRADIENTURLSTRING}-input ProductAttributesInput {+input AttributesInput {slug: String!name: String!}@@ -1372,8 +1372,8 @@ type ProductType implements Node {id: ID!name: String!hasVariants: Boolean!- productAttributes(before: String, after: String, first: Int, last: Int, id: ID, slug: String): ProductAttributeCountableConnection- variantAttributes(before: String, after: String, first: Int, last: Int, id: ID, slug: String): ProductAttributeCountableConnection+ productAttributes(before: String, after: String, first: Int, last: Int, id: ID, slug: String): AttributeCountableConnection+ variantAttributes(before: String, after: String, first: Int, last: Int, id: ID, slug: String): AttributeCountableConnectionisShippingRequired: Boolean!taxRate: TaxRateTypeweight: Weight@@ -1488,7 +1488,7 @@ type ProductVariantUpdate {type Query {addressValidator(input: AddressValidationInput!): AddressValidationData- attributes(query: String, inCategory: ID, before: String, after: String, first: Int, last: Int, id: ID, slug: String): ProductAttributeCountableConnection+ attributes(query: String, inCategory: ID, before: String, after: String, first: Int, last: Int, id: ID, slug: String): AttributeCountableConnectioncategories(query: String, level: Int, before: String, after: String, first: Int, last: Int, id: ID, name: String): CategoryCountableConnectioncategory(id: ID): Categorycollection(id: ID): Collection@@ -1580,8 +1580,8 @@ type SaleUpdate {}type SelectedAttribute {- attribute: ProductAttribute- value: ProductAttributeValue+ attribute: Attribute+ value: AttributeValue}input SeoInput {diff --git a/saleor/product/filters.py b/saleor/product/filters.pyindex 45c29b3a56..784e8c6ce5 100644--- a/saleor/product/filters.py+++ b/saleor/product/filters.py@@ -6,7 +6,7 @@ from django.utils.translation import pgettext_lazyfrom django_filters import MultipleChoiceFilter, OrderingFilter, RangeFilterfrom ..core.filters import SortedFilterSet-from .models import Product, ProductAttribute+from .models import Product, AttributeSORT_BY_FIELDS = OrderedDict([('name', pgettext_lazy('Product list sorting option', 'name')),@@ -39,12 +39,12 @@ class ProductFilter(SortedFilterSet):q_product_attributes = self._get_product_attributes_lookup()q_variant_attributes = self._get_variant_attributes_lookup()product_attributes = (- ProductAttribute.objects.all()+ Attribute.objects.all().prefetch_related('translations', 'values__translations').filter(q_product_attributes).distinct())variant_attributes = (- ProductAttribute.objects.all()+ Attribute.objects.all().prefetch_related('translations', 'values__translations').filter(q_variant_attributes).distinct())diff --git a/saleor/product/models.py b/saleor/product/models.pyindex 8a3011ac2b..dc1c233618 100644--- a/saleor/product/models.py+++ b/saleor/product/models.py@@ -76,9 +76,9 @@ class ProductType(models.Model):name = models.CharField(max_length=128)has_variants = models.BooleanField(default=True)product_attributes = models.ManyToManyField(- 'ProductAttribute', related_name='product_types', blank=True)+ 'Attribute', related_name='product_types', blank=True)variant_attributes = models.ManyToManyField(- 'ProductAttribute', related_name='product_variant_types', blank=True)+ 'Attribute', related_name='product_variant_types', blank=True)is_shipping_required = models.BooleanField(default=False)tax_rate = models.CharField(max_length=128, default=DEFAULT_TAX_RATE_NAME, blank=True,@@ -317,7 +317,7 @@ class ProductVariantTranslation(models.Model):return self.name or str(self.product_variant)-class ProductAttribute(models.Model):+class Attribute(models.Model):slug = models.SlugField(max_length=50, unique=True)name = models.CharField(max_length=100)@@ -336,20 +336,20 @@ class ProductAttribute(models.Model):return self.values.exists()-class ProductAttributeTranslation(models.Model):+class AttributeTranslation(models.Model):language_code = models.CharField(max_length=10)- product_attribute = models.ForeignKey(- ProductAttribute, related_name='translations',+ attribute = models.ForeignKey(+ Attribute, related_name='translations',on_delete=models.CASCADE)name = models.CharField(max_length=100)class Meta:- unique_together = (('language_code', 'product_attribute'),)+ unique_together = (('language_code', 'attribute'),)def __repr__(self):class_ = type(self)return '%s(pk=%r, name=%r, attribute_pk=%r)' % (- class_.__name__, self.pk, self.name, self.product_attribute_id)+ class_.__name__, self.pk, self.name, self.attribute_id)def __str__(self):return self.name@@ -360,7 +360,7 @@ class AttributeValue(SortableModel):value = models.CharField(max_length=100, default='')slug = models.SlugField(max_length=100)attribute = models.ForeignKey(- ProductAttribute, related_name='values', on_delete=models.CASCADE)+ Attribute, related_name='values', on_delete=models.CASCADE)translated = TranslationProxy()diff --git a/saleor/product/utils/attributes.py b/saleor/product/utils/attributes.pyindex a939e7355e..52e3a86690 100644--- a/saleor/product/utils/attributes.py+++ b/saleor/product/utils/attributes.py@@ -1,6 +1,6 @@def get_product_attributes_data(product):"""Returns attributes associated with the product,- as dict of ProductAttribute: AttributeValue values.+ as dict of Attribute: AttributeValue values."""attributes = product.product_type.product_attributes.all()attributes_map = {@@ -19,10 +19,10 @@ def get_name_from_attributes(variant, attributes):def get_attributes_display_map(obj, attributes):"""Returns attributes associated with an object,- as dict of ProductAttribute: AttributeValue values.+ as dict of Attribute: AttributeValue values.Args:- attributes: ProductAttribute Iterable+ attributes: Attribute Iterable"""display_map = {}for attribute in attributes:diff --git a/saleor/static/dashboard-next/productTypes/types/ProductTypeCreate.ts b/saleor/static/dashboard-next/productTypes/types/ProductTypeCreate.tsindex 924329220f..fde6f06fc4 100644--- a/saleor/static/dashboard-next/productTypes/types/ProductTypeCreate.ts+++ b/saleor/static/dashboard-next/productTypes/types/ProductTypeCreate.ts@@ -14,36 +14,36 @@ export interface ProductTypeCreate_productTypeCreate_errors {}export interface ProductTypeCreate_productTypeCreate_productType_productAttributes_edges_node {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;slug: string | null;name: string | null;}export interface ProductTypeCreate_productTypeCreate_productType_productAttributes_edges {- __typename: "ProductAttributeCountableEdge";+ __typename: "AttributeCountableEdge";node: ProductTypeCreate_productTypeCreate_productType_productAttributes_edges_node;}export interface ProductTypeCreate_productTypeCreate_productType_productAttributes {- __typename: "ProductAttributeCountableConnection";+ __typename: "AttributeCountableConnection";edges: ProductTypeCreate_productTypeCreate_productType_productAttributes_edges[];}export interface ProductTypeCreate_productTypeCreate_productType_variantAttributes_edges_node {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;slug: string | null;name: string | null;}export interface ProductTypeCreate_productTypeCreate_productType_variantAttributes_edges {- __typename: "ProductAttributeCountableEdge";+ __typename: "AttributeCountableEdge";node: ProductTypeCreate_productTypeCreate_productType_variantAttributes_edges_node;}export interface ProductTypeCreate_productTypeCreate_productType_variantAttributes {- __typename: "ProductAttributeCountableConnection";+ __typename: "AttributeCountableConnection";edges: ProductTypeCreate_productTypeCreate_productType_variantAttributes_edges[];}diff --git a/saleor/static/dashboard-next/productTypes/types/ProductTypeDetails.ts b/saleor/static/dashboard-next/productTypes/types/ProductTypeDetails.tsindex d9b22db01c..54824fbc40 100644--- a/saleor/static/dashboard-next/productTypes/types/ProductTypeDetails.ts+++ b/saleor/static/dashboard-next/productTypes/types/ProductTypeDetails.ts@@ -8,36 +8,36 @@ import { TaxRateType } from "./../../types/globalTypes";// ====================================================export interface ProductTypeDetails_productType_productAttributes_edges_node {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;slug: string | null;name: string | null;}export interface ProductTypeDetails_productType_productAttributes_edges {- __typename: "ProductAttributeCountableEdge";+ __typename: "AttributeCountableEdge";node: ProductTypeDetails_productType_productAttributes_edges_node;}export interface ProductTypeDetails_productType_productAttributes {- __typename: "ProductAttributeCountableConnection";+ __typename: "AttributeCountableConnection";edges: ProductTypeDetails_productType_productAttributes_edges[];}export interface ProductTypeDetails_productType_variantAttributes_edges_node {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;slug: string | null;name: string | null;}export interface ProductTypeDetails_productType_variantAttributes_edges {- __typename: "ProductAttributeCountableEdge";+ __typename: "AttributeCountableEdge";node: ProductTypeDetails_productType_variantAttributes_edges_node;}export interface ProductTypeDetails_productType_variantAttributes {- __typename: "ProductAttributeCountableConnection";+ __typename: "AttributeCountableConnection";edges: ProductTypeDetails_productType_variantAttributes_edges[];}diff --git a/saleor/static/dashboard-next/productTypes/types/ProductTypeList.ts b/saleor/static/dashboard-next/productTypes/types/ProductTypeList.tsindex 77c87fb0f3..a8e457fb3f 100644--- a/saleor/static/dashboard-next/productTypes/types/ProductTypeList.ts+++ b/saleor/static/dashboard-next/productTypes/types/ProductTypeList.ts@@ -6,34 +6,34 @@// ====================================================export interface ProductTypeList_productTypes_edges_node_productAttributes_edges_node {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;name: string | null;}export interface ProductTypeList_productTypes_edges_node_productAttributes_edges {- __typename: "ProductAttributeCountableEdge";+ __typename: "AttributeCountableEdge";node: ProductTypeList_productTypes_edges_node_productAttributes_edges_node;}export interface ProductTypeList_productTypes_edges_node_productAttributes {- __typename: "ProductAttributeCountableConnection";+ __typename: "AttributeCountableConnection";edges: ProductTypeList_productTypes_edges_node_productAttributes_edges[];}export interface ProductTypeList_productTypes_edges_node_variantAttributes_edges_node {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;name: string | null;}export interface ProductTypeList_productTypes_edges_node_variantAttributes_edges {- __typename: "ProductAttributeCountableEdge";+ __typename: "AttributeCountableEdge";node: ProductTypeList_productTypes_edges_node_variantAttributes_edges_node;}export interface ProductTypeList_productTypes_edges_node_variantAttributes {- __typename: "ProductAttributeCountableConnection";+ __typename: "AttributeCountableConnection";edges: ProductTypeList_productTypes_edges_node_variantAttributes_edges[];}diff --git a/saleor/static/dashboard-next/productTypes/types/ProductTypeUpdate.ts b/saleor/static/dashboard-next/productTypes/types/ProductTypeUpdate.tsindex 500e8205f5..ca44d9cca7 100644--- a/saleor/static/dashboard-next/productTypes/types/ProductTypeUpdate.ts+++ b/saleor/static/dashboard-next/productTypes/types/ProductTypeUpdate.ts@@ -14,36 +14,36 @@ export interface ProductTypeUpdate_productTypeUpdate_errors {}export interface ProductTypeUpdate_productTypeUpdate_productType_productAttributes_edges_node {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;slug: string | null;name: string | null;}export interface ProductTypeUpdate_productTypeUpdate_productType_productAttributes_edges {- __typename: "ProductAttributeCountableEdge";+ __typename: "AttributeCountableEdge";node: ProductTypeUpdate_productTypeUpdate_productType_productAttributes_edges_node;}export interface ProductTypeUpdate_productTypeUpdate_productType_productAttributes {- __typename: "ProductAttributeCountableConnection";+ __typename: "AttributeCountableConnection";edges: ProductTypeUpdate_productTypeUpdate_productType_productAttributes_edges[];}export interface ProductTypeUpdate_productTypeUpdate_productType_variantAttributes_edges_node {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;slug: string | null;name: string | null;}export interface ProductTypeUpdate_productTypeUpdate_productType_variantAttributes_edges {- __typename: "ProductAttributeCountableEdge";+ __typename: "AttributeCountableEdge";node: ProductTypeUpdate_productTypeUpdate_productType_variantAttributes_edges_node;}export interface ProductTypeUpdate_productTypeUpdate_productType_variantAttributes {- __typename: "ProductAttributeCountableConnection";+ __typename: "AttributeCountableConnection";edges: ProductTypeUpdate_productTypeUpdate_productType_variantAttributes_edges[];}diff --git a/saleor/static/dashboard-next/productTypes/types/SearchAttribute.ts b/saleor/static/dashboard-next/productTypes/types/SearchAttribute.tsindex 8c5362a6fd..560abb095d 100644--- a/saleor/static/dashboard-next/productTypes/types/SearchAttribute.ts+++ b/saleor/static/dashboard-next/productTypes/types/SearchAttribute.ts@@ -6,19 +6,19 @@// ====================================================export interface SearchAttribute_attributes_edges_node {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;slug: string | null;name: string | null;}export interface SearchAttribute_attributes_edges {- __typename: "ProductAttributeCountableEdge";+ __typename: "AttributeCountableEdge";node: SearchAttribute_attributes_edges_node;}export interface SearchAttribute_attributes {- __typename: "ProductAttributeCountableConnection";+ __typename: "AttributeCountableConnection";edges: SearchAttribute_attributes_edges[];}diff --git a/saleor/static/dashboard-next/products/components/ProductAttributesForm/ProductAttributesForm.tsx b/saleor/static/dashboard-next/products/components/ProductAttributesForm/ProductAttributesForm.tsxindex a06d19a616..ddcce453e2 100644--- a/saleor/static/dashboard-next/products/components/ProductAttributesForm/ProductAttributesForm.tsx+++ b/saleor/static/dashboard-next/products/components/ProductAttributesForm/ProductAttributesForm.tsx@@ -10,7 +10,7 @@ import SingleSelectField from "../../../components/SingleSelectField";import Skeleton from "../../../components/Skeleton";import i18n from "../../../i18n";-interface ProductAttributesFormProps {+interface AttributesFormProps {attributes?: Array<{attribute: AttributeType;value: AttributeValueType;@@ -22,8 +22,8 @@ interface ProductAttributesFormProps {onChange(event: any);}-export const ProductAttributesForm: React.StatelessComponent<- ProductAttributesFormProps+export const AttributesForm: React.StatelessComponent<+ AttributesFormProps> = ({ attributes, data, disabled, onChange }) => (<Card><PageHeader title={i18n.t("Attributes")} />@@ -52,4 +52,4 @@ export const ProductAttributesForm: React.StatelessComponent<</CardContent></Card>);-export default ProductAttributesForm;+export default AttributesForm;diff --git a/saleor/static/dashboard-next/products/components/ProductAttributesForm/index.ts b/saleor/static/dashboard-next/products/components/ProductAttributesForm/index.tsindex 724931497f..e6de659863 100644--- a/saleor/static/dashboard-next/products/components/ProductAttributesForm/index.ts+++ b/saleor/static/dashboard-next/products/components/ProductAttributesForm/index.ts@@ -1,2 +1,2 @@-export { default } from "./ProductAttributesForm";-export * from "./ProductAttributesForm";+export { default } from "./AttributesForm";+export * from "./AttributesForm";diff --git a/saleor/static/dashboard-next/products/components/ProductOrganization/ProductOrganization.tsx b/saleor/static/dashboard-next/products/components/ProductOrganization/ProductOrganization.tsxindex 5b1db708b2..206c754153 100644--- a/saleor/static/dashboard-next/products/components/ProductOrganization/ProductOrganization.tsx+++ b/saleor/static/dashboard-next/products/components/ProductOrganization/ProductOrganization.tsx@@ -133,7 +133,7 @@ const ProductOrganization = decorate<ProductOrganizationProps>(}});};- const handleProductAttributeValueSelect = (+ const handleAttributeValueSelect = (event: React.ChangeEvent<{name: string;value: {@@ -207,7 +207,7 @@ const ProductOrganization = decorate<ProductOrganizationProps>(disabled={disabled}name={item.slug}label={getAttributeName(item.slug)}- onChange={handleProductAttributeValueSelect}+ onChange={handleAttributeValueSelect}value={getAttributeValue(item.slug)}choices={getAttributeValues(item.slug).map(v => ({label: v.name,diff --git a/saleor/static/dashboard-next/products/components/ProductVariantAttributes/ProductVariantAttributes.tsx b/saleor/static/dashboard-next/products/components/ProductVariantAttributes/ProductVariantAttributes.tsxindex 6a0407f572..bbe1151da6 100644--- a/saleor/static/dashboard-next/products/components/ProductVariantAttributes/ProductVariantAttributes.tsx+++ b/saleor/static/dashboard-next/products/components/ProductVariantAttributes/ProductVariantAttributes.tsx@@ -80,7 +80,7 @@ const ProductVariantAttributes = decorate<ProductVariantAttributesProps>(})): [];};- const handleProductAttributeValueSelect = (+ const handleAttributeValueSelect = (event: React.ChangeEvent<{name: string;value: {@@ -109,7 +109,7 @@ const ProductVariantAttributes = decorate<ProductVariantAttributesProps>(disabled={disabled}name={item.slug}label={item.name}- onChange={handleProductAttributeValueSelect}+ onChange={handleAttributeValueSelect}value={getAttributeValue(item.slug)}choices={getAttributeValues(item.slug)}key={index}diff --git a/saleor/static/dashboard-next/products/types/Product.ts b/saleor/static/dashboard-next/products/types/Product.tsindex c02bcc0fce..550afb6b62 100644--- a/saleor/static/dashboard-next/products/types/Product.ts+++ b/saleor/static/dashboard-next/products/types/Product.ts@@ -58,13 +58,13 @@ export interface Product_purchaseCost {}export interface Product_attributes_attribute_values {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";name: string | null;slug: string | null;}export interface Product_attributes_attribute {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;slug: string | null;name: string | null;@@ -72,7 +72,7 @@ export interface Product_attributes_attribute {}export interface Product_attributes_value {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";id: string;name: string | null;slug: string | null;diff --git a/saleor/static/dashboard-next/products/types/ProductCreate.ts b/saleor/static/dashboard-next/products/types/ProductCreate.tsindex c9d454b87b..f72d95f33c 100644--- a/saleor/static/dashboard-next/products/types/ProductCreate.ts+++ b/saleor/static/dashboard-next/products/types/ProductCreate.ts@@ -66,13 +66,13 @@ export interface ProductCreate_productCreate_product_purchaseCost {}export interface ProductCreate_productCreate_product_attributes_attribute_values {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";name: string | null;slug: string | null;}export interface ProductCreate_productCreate_product_attributes_attribute {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;slug: string | null;name: string | null;@@ -80,7 +80,7 @@ export interface ProductCreate_productCreate_product_attributes_attribute {}export interface ProductCreate_productCreate_product_attributes_value {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";id: string;name: string | null;slug: string | null;diff --git a/saleor/static/dashboard-next/products/types/ProductCreateData.ts b/saleor/static/dashboard-next/products/types/ProductCreateData.tsindex c9c0f2fc91..447696091c 100644--- a/saleor/static/dashboard-next/products/types/ProductCreateData.ts+++ b/saleor/static/dashboard-next/products/types/ProductCreateData.ts@@ -6,7 +6,7 @@// ====================================================export interface ProductCreateData_productTypes_edges_node_productAttributes_edges_node_values {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";id: string;sortOrder: number;name: string | null;@@ -14,7 +14,7 @@ export interface ProductCreateData_productTypes_edges_node_productAttributes_edg}export interface ProductCreateData_productTypes_edges_node_productAttributes_edges_node {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;slug: string | null;name: string | null;@@ -22,12 +22,12 @@ export interface ProductCreateData_productTypes_edges_node_productAttributes_edg}export interface ProductCreateData_productTypes_edges_node_productAttributes_edges {- __typename: "ProductAttributeCountableEdge";+ __typename: "AttributeCountableEdge";node: ProductCreateData_productTypes_edges_node_productAttributes_edges_node;}export interface ProductCreateData_productTypes_edges_node_productAttributes {- __typename: "ProductAttributeCountableConnection";+ __typename: "AttributeCountableConnection";edges: ProductCreateData_productTypes_edges_node_productAttributes_edges[];}diff --git a/saleor/static/dashboard-next/products/types/ProductDetails.ts b/saleor/static/dashboard-next/products/types/ProductDetails.tsindex 3a8e7d173e..df311260f5 100644--- a/saleor/static/dashboard-next/products/types/ProductDetails.ts+++ b/saleor/static/dashboard-next/products/types/ProductDetails.ts@@ -58,13 +58,13 @@ export interface ProductDetails_product_purchaseCost {}export interface ProductDetails_product_attributes_attribute_values {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";name: string | null;slug: string | null;}export interface ProductDetails_product_attributes_attribute {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;slug: string | null;name: string | null;@@ -72,7 +72,7 @@ export interface ProductDetails_product_attributes_attribute {}export interface ProductDetails_product_attributes_value {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";id: string;name: string | null;slug: string | null;diff --git a/saleor/static/dashboard-next/products/types/ProductImageCreate.ts b/saleor/static/dashboard-next/products/types/ProductImageCreate.tsindex ae04ca3a0d..77b6bece2f 100644--- a/saleor/static/dashboard-next/products/types/ProductImageCreate.ts+++ b/saleor/static/dashboard-next/products/types/ProductImageCreate.ts@@ -64,13 +64,13 @@ export interface ProductImageCreate_productImageCreate_product_purchaseCost {}export interface ProductImageCreate_productImageCreate_product_attributes_attribute_values {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";name: string | null;slug: string | null;}export interface ProductImageCreate_productImageCreate_product_attributes_attribute {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;slug: string | null;name: string | null;@@ -78,7 +78,7 @@ export interface ProductImageCreate_productImageCreate_product_attributes_attrib}export interface ProductImageCreate_productImageCreate_product_attributes_value {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";id: string;name: string | null;slug: string | null;diff --git a/saleor/static/dashboard-next/products/types/ProductImageUpdate.ts b/saleor/static/dashboard-next/products/types/ProductImageUpdate.tsindex d5268bdb7c..bea80a0b89 100644--- a/saleor/static/dashboard-next/products/types/ProductImageUpdate.ts+++ b/saleor/static/dashboard-next/products/types/ProductImageUpdate.ts@@ -64,13 +64,13 @@ export interface ProductImageUpdate_productImageUpdate_product_purchaseCost {}export interface ProductImageUpdate_productImageUpdate_product_attributes_attribute_values {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";name: string | null;slug: string | null;}export interface ProductImageUpdate_productImageUpdate_product_attributes_attribute {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;slug: string | null;name: string | null;@@ -78,7 +78,7 @@ export interface ProductImageUpdate_productImageUpdate_product_attributes_attrib}export interface ProductImageUpdate_productImageUpdate_product_attributes_value {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";id: string;name: string | null;slug: string | null;diff --git a/saleor/static/dashboard-next/products/types/ProductUpdate.ts b/saleor/static/dashboard-next/products/types/ProductUpdate.tsindex 12f4f98c79..4268c8469d 100644--- a/saleor/static/dashboard-next/products/types/ProductUpdate.ts+++ b/saleor/static/dashboard-next/products/types/ProductUpdate.ts@@ -66,13 +66,13 @@ export interface ProductUpdate_productUpdate_product_purchaseCost {}export interface ProductUpdate_productUpdate_product_attributes_attribute_values {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";name: string | null;slug: string | null;}export interface ProductUpdate_productUpdate_product_attributes_attribute {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;slug: string | null;name: string | null;@@ -80,7 +80,7 @@ export interface ProductUpdate_productUpdate_product_attributes_attribute {}export interface ProductUpdate_productUpdate_product_attributes_value {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";id: string;name: string | null;slug: string | null;diff --git a/saleor/static/dashboard-next/products/types/ProductVariant.ts b/saleor/static/dashboard-next/products/types/ProductVariant.tsindex 82c9ca3cc4..993b44f943 100644--- a/saleor/static/dashboard-next/products/types/ProductVariant.ts+++ b/saleor/static/dashboard-next/products/types/ProductVariant.ts@@ -6,14 +6,14 @@// ====================================================export interface ProductVariant_attributes_attribute_values {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";id: string;name: string | null;slug: string | null;}export interface ProductVariant_attributes_attribute {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;name: string | null;slug: string | null;@@ -21,7 +21,7 @@ export interface ProductVariant_attributes_attribute {}export interface ProductVariant_attributes_value {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";id: string;name: string | null;slug: string | null;diff --git a/saleor/static/dashboard-next/products/types/ProductVariantCreateData.ts b/saleor/static/dashboard-next/products/types/ProductVariantCreateData.tsindex 8500879f07..099503e4e4 100644--- a/saleor/static/dashboard-next/products/types/ProductVariantCreateData.ts+++ b/saleor/static/dashboard-next/products/types/ProductVariantCreateData.ts@@ -23,7 +23,7 @@ export interface ProductVariantCreateData_product_images {}export interface ProductVariantCreateData_product_productType_variantAttributes_edges_node_values {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";id: string;sortOrder: number;name: string | null;@@ -31,7 +31,7 @@ export interface ProductVariantCreateData_product_productType_variantAttributes_}export interface ProductVariantCreateData_product_productType_variantAttributes_edges_node {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;slug: string | null;name: string | null;@@ -39,12 +39,12 @@ export interface ProductVariantCreateData_product_productType_variantAttributes_}export interface ProductVariantCreateData_product_productType_variantAttributes_edges {- __typename: "ProductAttributeCountableEdge";+ __typename: "AttributeCountableEdge";node: ProductVariantCreateData_product_productType_variantAttributes_edges_node;}export interface ProductVariantCreateData_product_productType_variantAttributes {- __typename: "ProductAttributeCountableConnection";+ __typename: "AttributeCountableConnection";edges: ProductVariantCreateData_product_productType_variantAttributes_edges[];}diff --git a/saleor/static/dashboard-next/products/types/ProductVariantDetails.ts b/saleor/static/dashboard-next/products/types/ProductVariantDetails.tsindex 8bf747a48b..5c3005bedb 100644--- a/saleor/static/dashboard-next/products/types/ProductVariantDetails.ts+++ b/saleor/static/dashboard-next/products/types/ProductVariantDetails.ts@@ -6,14 +6,14 @@// ====================================================export interface ProductVariantDetails_productVariant_attributes_attribute_values {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";id: string;name: string | null;slug: string | null;}export interface ProductVariantDetails_productVariant_attributes_attribute {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;name: string | null;slug: string | null;@@ -21,7 +21,7 @@ export interface ProductVariantDetails_productVariant_attributes_attribute {}export interface ProductVariantDetails_productVariant_attributes_value {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";id: string;name: string | null;slug: string | null;diff --git a/saleor/static/dashboard-next/products/types/VariantCreate.ts b/saleor/static/dashboard-next/products/types/VariantCreate.tsindex 59c275663a..123eee96e9 100644--- a/saleor/static/dashboard-next/products/types/VariantCreate.ts+++ b/saleor/static/dashboard-next/products/types/VariantCreate.ts@@ -14,14 +14,14 @@ export interface VariantCreate_productVariantCreate_errors {}export interface VariantCreate_productVariantCreate_productVariant_attributes_attribute_values {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";id: string;name: string | null;slug: string | null;}export interface VariantCreate_productVariantCreate_productVariant_attributes_attribute {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;name: string | null;slug: string | null;@@ -29,7 +29,7 @@ export interface VariantCreate_productVariantCreate_productVariant_attributes_at}export interface VariantCreate_productVariantCreate_productVariant_attributes_value {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";id: string;name: string | null;slug: string | null;diff --git a/saleor/static/dashboard-next/products/types/VariantImageAssign.ts b/saleor/static/dashboard-next/products/types/VariantImageAssign.tsindex 3527f5a73a..49aab2c2bf 100644--- a/saleor/static/dashboard-next/products/types/VariantImageAssign.ts+++ b/saleor/static/dashboard-next/products/types/VariantImageAssign.ts@@ -12,14 +12,14 @@ export interface VariantImageAssign_variantImageAssign_errors {}export interface VariantImageAssign_variantImageAssign_productVariant_attributes_attribute_values {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";id: string;name: string | null;slug: string | null;}export interface VariantImageAssign_variantImageAssign_productVariant_attributes_attribute {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;name: string | null;slug: string | null;@@ -27,7 +27,7 @@ export interface VariantImageAssign_variantImageAssign_productVariant_attributes}export interface VariantImageAssign_variantImageAssign_productVariant_attributes_value {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";id: string;name: string | null;slug: string | null;diff --git a/saleor/static/dashboard-next/products/types/VariantImageUnassign.ts b/saleor/static/dashboard-next/products/types/VariantImageUnassign.tsindex 0813a21abc..e554bd59b2 100644--- a/saleor/static/dashboard-next/products/types/VariantImageUnassign.ts+++ b/saleor/static/dashboard-next/products/types/VariantImageUnassign.ts@@ -12,14 +12,14 @@ export interface VariantImageUnassign_variantImageUnassign_errors {}export interface VariantImageUnassign_variantImageUnassign_productVariant_attributes_attribute_values {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";id: string;name: string | null;slug: string | null;}export interface VariantImageUnassign_variantImageUnassign_productVariant_attributes_attribute {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;name: string | null;slug: string | null;@@ -27,7 +27,7 @@ export interface VariantImageUnassign_variantImageUnassign_productVariant_attrib}export interface VariantImageUnassign_variantImageUnassign_productVariant_attributes_value {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";id: string;name: string | null;slug: string | null;diff --git a/saleor/static/dashboard-next/products/types/VariantUpdate.ts b/saleor/static/dashboard-next/products/types/VariantUpdate.tsindex 3d96df1c62..0067906753 100644--- a/saleor/static/dashboard-next/products/types/VariantUpdate.ts+++ b/saleor/static/dashboard-next/products/types/VariantUpdate.ts@@ -14,14 +14,14 @@ export interface VariantUpdate_productVariantUpdate_errors {}export interface VariantUpdate_productVariantUpdate_productVariant_attributes_attribute_values {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";id: string;name: string | null;slug: string | null;}export interface VariantUpdate_productVariantUpdate_productVariant_attributes_attribute {- __typename: "ProductAttribute";+ __typename: "Attribute";id: string;name: string | null;slug: string | null;@@ -29,7 +29,7 @@ export interface VariantUpdate_productVariantUpdate_productVariant_attributes_at}export interface VariantUpdate_productVariantUpdate_productVariant_attributes_value {- __typename: "ProductAttributeValue";+ __typename: "AttributeValue";id: string;name: string | null;slug: string | null;diff --git a/tests/api/test_attributes.py b/tests/api/test_attributes.pyindex 72345adb8a..0831ab0b1e 100644--- a/tests/api/test_attributes.py+++ b/tests/api/test_attributes.py@@ -6,9 +6,9 @@ import pytestfrom django.shortcuts import reversefrom tests.utils import get_graphql_contentfrom saleor.product.models import (- Category, ProductAttribute, AttributeValue)+ Category, Attribute, AttributeValue)from saleor.graphql.product.utils import attributes_to_hstore-from saleor.graphql.product.types import resolve_attribute_value_type, ProductAttributeValueType+from saleor.graphql.product.types import resolve_attribute_value_type, AttributeValueTypedef test_attributes_to_hstore(product, color_attribute):@@ -38,7 +38,7 @@ def test_attributes_to_hstore(product, color_attribute):def test_attributes_query(user_api_client, product):- attributes = ProductAttribute.objects.prefetch_related('values')+ attributes = Attribute.objects.prefetch_related('values')query = '''query {attributes {@@ -88,10 +88,10 @@ def test_attributes_in_category_query(user_api_client, product):content = get_graphql_content(response)assert 'errors' not in contentattributes_data = content['data']['attributes']['edges']- assert len(attributes_data) == ProductAttribute.objects.count()+ assert len(attributes_data) == Attribute.objects.count()-def test_create_product_attribute(admin_api_client):+def test_create_attribute(admin_api_client):query = """mutation createAttribute($name: String!, $slug: String!) {productAttributeCreate(input: {name: $name, slug: $slug}) {@@ -119,7 +119,7 @@ def test_create_product_attribute(admin_api_client):assert not data['values']-def test_update_product_attribute(admin_api_client, color_attribute):+def test_update_attribute(admin_api_client, color_attribute):attribute = color_attributequery = """mutation updateAttribute($id: ID!, $name: String!, $slug: String!) {@@ -132,7 +132,7 @@ def test_update_product_attribute(admin_api_client, color_attribute):"""name = 'Wings name'slug = attribute.slug- id = graphene.Node.to_global_id('ProductAttribute', attribute.id)+ id = graphene.Node.to_global_id('Attribute', attribute.id)variables = json.dumps({'name': name, 'id': id, 'slug': slug})response = admin_api_client.post(reverse('api'), {'query': query, 'variables': variables})@@ -143,7 +143,7 @@ def test_update_product_attribute(admin_api_client, color_attribute):assert data['name'] == name == attribute.name-def test_delete_product_attribute(admin_api_client, color_attribute):+def test_delete_attribute(admin_api_client, color_attribute):attribute = color_attributequery = """mutation deleteAttribute($id: ID!) {@@ -154,7 +154,7 @@ def test_delete_product_attribute(admin_api_client, color_attribute):}}"""- id = graphene.Node.to_global_id('ProductAttribute', attribute.id)+ id = graphene.Node.to_global_id('Attribute', attribute.id)variables = json.dumps({'id': id})response = admin_api_client.post(reverse('api'), {'query': query, 'variables': variables})@@ -179,7 +179,7 @@ def test_create_attribute_value(admin_api_client, color_attribute):}}"""- attribute_id = graphene.Node.to_global_id('ProductAttribute', attribute.id)+ attribute_id = graphene.Node.to_global_id('Attribute', attribute.id)name = 'test name'slug = 'test-slug'value = 'test-string'@@ -210,7 +210,7 @@ def test_update_attribute_value(admin_api_client, pink_attribute_value):}}"""- id = graphene.Node.to_global_id('ProductAttributeValue', value.id)+ id = graphene.Node.to_global_id('AttributeValue', value.id)name = 'Crimson'slug = value.slugvariables = json.dumps(@@ -239,7 +239,7 @@ def test_delete_attribute_value(}}"""- id = graphene.Node.to_global_id('ProductAttributeValue', value.id)+ id = graphene.Node.to_global_id('AttributeValue', value.id)variables = json.dumps({'id': id})response = admin_api_client.post(reverse('api'), {'query': query, 'variables': variables})@@ -250,19 +250,19 @@ def test_delete_attribute_value(@pytest.mark.parametrize('raw_value, expected_type', [- ('#0000', ProductAttributeValueType.COLOR),- ('#FF69B4', ProductAttributeValueType.COLOR),- ('rgb(255, 0, 0)', ProductAttributeValueType.COLOR),- ('hsl(0, 100%, 50%)', ProductAttributeValueType.COLOR),- ('hsla(120, 60%, 70%, 0.3)', ProductAttributeValueType.COLOR),- ('rgba(100%, 255, 0, 0)', ProductAttributeValueType.COLOR),- ('http://example.com', ProductAttributeValueType.URL),- ('https://example.com', ProductAttributeValueType.URL),- ('ftp://example.com', ProductAttributeValueType.URL),- ('example.com', ProductAttributeValueType.STRING),- ('Foo', ProductAttributeValueType.STRING),- ('linear-gradient(red, yellow)', ProductAttributeValueType.GRADIENT),- ('radial-gradient(#0000, yellow)', ProductAttributeValueType.GRADIENT),+ ('#0000', AttributeValueType.COLOR),+ ('#FF69B4', AttributeValueType.COLOR),+ ('rgb(255, 0, 0)', AttributeValueType.COLOR),+ ('hsl(0, 100%, 50%)', AttributeValueType.COLOR),+ ('hsla(120, 60%, 70%, 0.3)', AttributeValueType.COLOR),+ ('rgba(100%, 255, 0, 0)', AttributeValueType.COLOR),+ ('http://example.com', AttributeValueType.URL),+ ('https://example.com', AttributeValueType.URL),+ ('ftp://example.com', AttributeValueType.URL),+ ('example.com', AttributeValueType.STRING),+ ('Foo', AttributeValueType.STRING),+ ('linear-gradient(red, yellow)', AttributeValueType.GRADIENT),+ ('radial-gradient(#0000, yellow)', AttributeValueType.GRADIENT),])def test_resolve_attribute_value_type(raw_value, expected_type):assert resolve_attribute_value_type(raw_value) == expected_type@@ -271,7 +271,7 @@ def test_resolve_attribute_value_type(raw_value, expected_type):def test_query_attribute_values(color_attribute, pink_attribute_value, user_api_client):attribute_id = graphene.Node.to_global_id(- 'ProductAttribute', color_attribute.id)+ 'Attribute', color_attribute.id)query = """query getAttribute($id: ID!) {attributes(id: $id) {@@ -301,4 +301,3 @@ def test_query_attribute_values(pink = pink[0]assert pink['value'] == '#FF69B4'assert pink['type'] == 'COLOR'-diff --git a/tests/api/test_graphql.py b/tests/api/test_graphql.pyindex 96392eccb2..bd4bb9b91e 100644--- a/tests/api/test_graphql.py+++ b/tests/api/test_graphql.py@@ -162,7 +162,7 @@ def test_real_query(user_api_client, product):__typename}- fragment ProductFiltersFragmentQuery on ProductAttribute {+ fragment ProductFiltersFragmentQuery on Attribute {idnameslugdiff --git a/tests/api/test_product.py b/tests/api/test_product.pyindex 1a1d6dcf83..6fa6714af7 100644--- a/tests/api/test_product.py+++ b/tests/api/test_product.py@@ -660,11 +660,11 @@ def test_product_type_create_mutation(admin_api_client, product_type):require_shipping = Trueproduct_attributes = product_type.product_attributes.all()product_attributes_ids = [- graphene.Node.to_global_id('ProductAttribute', att.id) for att in+ graphene.Node.to_global_id('Attribute', att.id) for att inproduct_attributes]variant_attributes = product_type.variant_attributes.all()variant_attributes_ids = [- graphene.Node.to_global_id('ProductAttribute', att.id) for att in+ graphene.Node.to_global_id('Attribute', att.id) for att invariant_attributes]variables = json.dumps({@@ -731,7 +731,7 @@ def test_product_type_update_mutation(admin_api_client, product_type):# but do not change variant attributesproduct_attributes = []product_attributes_ids = [- graphene.Node.to_global_id('ProductAttribute', att.id) for att in+ graphene.Node.to_global_id('Attribute', att.id) for att inproduct_attributes]variant_attributes = product_type.variant_attributes.all()@@ -1220,7 +1220,7 @@ def test_product_type_update_changes_variant_name(variant_attributes = product_type.variant_attributes.all()variant_attributes_ids = [- graphene.Node.to_global_id('ProductAttribute', att.id) for att in+ graphene.Node.to_global_id('Attribute', att.id) for att invariant_attributes]variables = json.dumps({'id': product_type_id,diff --git a/tests/conftest.py b/tests/conftest.pyindex 1df031f2e2..7f83973a65 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -31,8 +31,8 @@ from saleor.order.models import Orderfrom saleor.order.utils import recalculate_orderfrom saleor.page.models import Pagefrom saleor.product.models import (- AttributeValue, Category, Collection, Product, ProductAttribute,- ProductAttributeTranslation, ProductImage, ProductTranslation, ProductType,+ AttributeValue, Category, Collection, Product, Attribute,+ AttributeTranslation, ProductImage, ProductTranslation, ProductType,ProductVariant)from saleor.shipping.models import (ShippingMethod, ShippingMethodType, ShippingZone)@@ -243,7 +243,7 @@ def shipping_method(shipping_zone):@pytest.fixturedef color_attribute(db): # pylint: disable=W0613- attribute = ProductAttribute.objects.create(+ attribute = Attribute.objects.create(slug='color', name='Color')AttributeValue.objects.create(attribute=attribute, name='Red', slug='red')@@ -261,7 +261,7 @@ def pink_attribute_value(color_attribute): # pylint: disable=W0613@pytest.fixturedef size_attribute(db): # pylint: disable=W0613- attribute = ProductAttribute.objects.create(slug='size', name='Size')+ attribute = Attribute.objects.create(slug='size', name='Size')AttributeValue.objects.create(attribute=attribute, name='Small', slug='small')AttributeValue.objects.create(@@ -708,15 +708,15 @@ def vatlayer(db, settings, tax_rates, taxes):@pytest.fixturedef translated_variant_fr(product):attribute = product.product_type.variant_attributes.first()- return ProductAttributeTranslation.objects.create(+ return AttributeTranslation.objects.create(language_code='fr', product_attribute=attribute,name='Name tranlsated to french')@pytest.fixture-def translated_product_attribute(product):+def translated_attribute(product):attribute = product.product_type.product_attributes.first()- return ProductAttributeTranslation.objects.create(+ return AttributeTranslation.objects.create(language_code='fr', product_attribute=attribute,name='Name tranlsated to french')diff --git a/tests/dashboard/test_product.py b/tests/dashboard/test_product.pyindex e0bce8f65d..7e106fc793 100644--- a/tests/dashboard/test_product.py+++ b/tests/dashboard/test_product.py@@ -12,7 +12,7 @@ from saleor.dashboard.product import ProductBulkActionfrom saleor.dashboard.product.forms import ProductForm, ProductVariantFormfrom saleor.product.forms import VariantChoiceFieldfrom saleor.product.models import (- AttributeValue, Collection, Product, ProductAttribute, ProductImage,+ AttributeValue, Collection, Product, Attribute, ProductImage,ProductType, ProductVariant)from ..utils import create_image@@ -790,7 +790,7 @@ def test_view_attribute_details(admin_client, color_attribute):def test_view_attribute_details_no_choices(admin_client):- attribute = ProductAttribute.objects.create(slug='size', name='Size')+ attribute = Attribute.objects.create(slug='size', name='Size')url = reverse('dashboard:product-attribute-details', kwargs={'pk': attribute.pk})@@ -807,7 +807,7 @@ def test_view_attribute_create(admin_client, color_attribute):response = admin_client.post(url, data, follow=True)assert response.status_code == 200- assert ProductAttribute.objects.count() == 2+ assert Attribute.objects.count() == 2def test_view_attribute_create_not_valid(admin_client, color_attribute):@@ -817,7 +817,7 @@ def test_view_attribute_create_not_valid(admin_client, color_attribute):response = admin_client.post(url, data, follow=True)assert response.status_code == 200- assert ProductAttribute.objects.count() == 1+ assert Attribute.objects.count() == 1def test_view_attribute_edit(color_attribute, admin_client):@@ -829,7 +829,7 @@ def test_view_attribute_edit(color_attribute, admin_client):response = admin_client.post(url, data, follow=True)assert response.status_code == 200- assert ProductAttribute.objects.count() == 1+ assert Attribute.objects.count() == 1color_attribute.refresh_from_db()assert color_attribute.name == 'new_name'assert color_attribute.slug == 'new_slug'@@ -843,7 +843,7 @@ def test_view_attribute_delete(admin_client, color_attribute):response = admin_client.post(url)assert response.status_code == 302- assert not ProductAttribute.objects.filter(pk=color_attribute.pk).exists()+ assert not Attribute.objects.filter(pk=color_attribute.pk).exists()def test_view_attribute_not_deleted_before_confirmation(@@ -855,7 +855,7 @@ def test_view_attribute_not_deleted_before_confirmation(response = admin_client.get(url)assert response.status_code == 200- assert ProductAttribute.objects.filter(pk=color_attribute.pk)+ assert Attribute.objects.filter(pk=color_attribute.pk)def test_view_attribute_value_create(color_attribute, admin_client):@@ -955,7 +955,7 @@ def test_view_ajax_reorder_attribute_values_invalid(def test_get_formfield_name_with_unicode_characters(db):- text_attribute = ProductAttribute.objects.create(+ text_attribute = Attribute.objects.create(slug='ąęαβδηθλμπ', name='ąęαβδηθλμπ')assert text_attribute.get_formfield_name() == 'attribute-ąęαβδηθλμπ'@@ -989,7 +989,7 @@ def test_hide_field_in_variant_choice_field_form():def test_product_form_change_attributes(db, product, color_attribute):product_type = product.product_type- text_attribute = ProductAttribute.objects.create(+ text_attribute = Attribute.objects.create(slug='author', name='Author')product_type.product_attributes.add(text_attribute)color_value = color_attribute.values.first()diff --git a/tests/test_product_attributes.py b/tests/test_product_attributes.pyindex 6be76e340b..4345093b0f 100644--- a/tests/test_product_attributes.py+++ b/tests/test_product_attributes.py@@ -1,7 +1,7 @@import pytestfrom saleor.product.models import (- AttributeValue, Product, ProductAttribute)+ AttributeValue, Product, Attribute)from saleor.product.utils.attributes import (generate_name_from_values, get_attributes_display_map,get_name_from_attributes)@@ -51,7 +51,7 @@ def test_get_name_from_attributes_no_attributes(product_with_no_attributes):def test_generate_name_from_values():- attribute = ProductAttribute.objects.create(+ attribute = Attribute.objects.create(slug='color', name='Color')red = AttributeValue.objects.create(attribute=attribute, name='Red', slug='red')diff --git a/tests/test_translation.py b/tests/test_translation.pyindex 8bb95a1221..43079522e1 100644--- a/tests/test_translation.py+++ b/tests/test_translation.py@@ -2,7 +2,7 @@ import pytestfrom saleor.product.models import (AttributeValueTranslation, CategoryTranslation,- CollectionTranslation, ProductAttributeTranslation, ProductTranslation,+ CollectionTranslation, AttributeTranslation, ProductTranslation,ProductVariantTranslation)from saleor.shipping.models import ShippingMethodTranslation@@ -98,8 +98,8 @@ def test_product_variant_translation(settings, variant):assert variant.translated.name == french_name-def test_product_attribute_translation(settings, color_attribute):- ProductAttributeTranslation.objects.create(+def test_attribute_translation(settings, color_attribute):+ AttributeTranslation.objects.create(language_code='fr', product_attribute=color_attribute,name='French name')assert not color_attribute.translated.name == 'French name'