fixed error in serialier change ofr product search
This commit is contained in:
@@ -11,7 +11,7 @@ class ProductSerializer(TaggitSerializer, serializers.ModelSerializer):
|
|||||||
tags = TagListSerializerField(required=False)
|
tags = TagListSerializerField(required=False)
|
||||||
category = SingleTagSerializerField(required=False) # main tag category
|
category = SingleTagSerializerField(required=False) # main tag category
|
||||||
attributes = TagListSerializerField(required=False)
|
attributes = TagListSerializerField(required=False)
|
||||||
|
company = CompanySerializer(read_only=True)
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Product
|
model = Product
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|||||||
@@ -311,6 +311,8 @@ class ProductViewSetTest(APITestCase):
|
|||||||
|
|
||||||
# Assert instance has been modified
|
# Assert instance has been modified
|
||||||
for key in data:
|
for key in data:
|
||||||
|
if key == 'company':
|
||||||
|
continue
|
||||||
self.assertEqual(data[key], response.data[key])
|
self.assertEqual(data[key], response.data[key])
|
||||||
|
|
||||||
def test_auth_user_cannot_modify_other_users_instance(self):
|
def test_auth_user_cannot_modify_other_users_instance(self):
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ def product_search(request):
|
|||||||
return Response({"errors": {"details": "No query string to parse"}})
|
return Response({"errors": {"details": "No query string to parse"}})
|
||||||
elif q is '':
|
elif q is '':
|
||||||
# return everything
|
# return everything
|
||||||
serializer = SearchResultSerializer(Product.objects.all(), many=True)
|
serializer = ProductSerializer(Product.objects.all(), many=True)
|
||||||
products = serializer.data
|
products = serializer.data
|
||||||
# filters = extract_search_filters(products)
|
# filters = extract_search_filters(products)
|
||||||
return Response(data={"filters": [], "count": len(products), "products": products})
|
return Response(data={"filters": [], "count": len(products), "products": products})
|
||||||
|
|||||||
Reference in New Issue
Block a user