diff --git a/products/serializers.py b/products/serializers.py index 68de558..7195e8f 100644 --- a/products/serializers.py +++ b/products/serializers.py @@ -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__' diff --git a/products/tests.py b/products/tests.py index 720ea1b..81f7916 100644 --- a/products/tests.py +++ b/products/tests.py @@ -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): diff --git a/products/views.py b/products/views.py index efc40c6..697203a 100644 --- a/products/views.py +++ b/products/views.py @@ -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})