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)
|
||||
category = SingleTagSerializerField(required=False) # main tag category
|
||||
attributes = TagListSerializerField(required=False)
|
||||
|
||||
company = CompanySerializer(read_only=True)
|
||||
class Meta:
|
||||
model = Product
|
||||
fields = '__all__'
|
||||
|
||||
@@ -311,6 +311,8 @@ class ProductViewSetTest(APITestCase):
|
||||
|
||||
# Assert instance has been modified
|
||||
for key in data:
|
||||
if key == 'company':
|
||||
continue
|
||||
self.assertEqual(data[key], response.data[key])
|
||||
|
||||
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"}})
|
||||
elif q is '':
|
||||
# return everything
|
||||
serializer = SearchResultSerializer(Product.objects.all(), many=True)
|
||||
serializer = ProductSerializer(Product.objects.all(), many=True)
|
||||
products = serializer.data
|
||||
# filters = extract_search_filters(products)
|
||||
return Response(data={"filters": [], "count": len(products), "products": products})
|
||||
|
||||
Reference in New Issue
Block a user