问题:
商品列表页面不显示商品
TypeError: 'type' object is not iterable
WARNING base 152 Not Found: /categories/115/hotskus/
WARNING base 152 Not Found: /categories/115/
WARNING basehttp 124 "GET /categories/115/ HTTP/1.1" 404 8793
WARNING basehttp 124 "GET /categories/115/hotskus/ HTTP/1.1" 404 8817
INFO basehttp 124 "GET /cart/ HTTP/1.1" 200 929
ERROR basehttp 124 "GET /categories/115/skus/?page=1&page_size=5&ordering=-create_time HTTP/1.1" 500 20403
解决:
# 指定过滤排序的后端
filter_backends = (OrderingFilter)
# 从路径中获取商品列表所要展示的分类
category_id = self.kwargs['category_id']
修改为
filter_backends = [OrderingFilter]
商品列表页面不显示商品
TypeError: 'type' object is not iterable
WARNING base 152 Not Found: /categories/115/hotskus/
WARNING base 152 Not Found: /categories/115/
WARNING basehttp 124 "GET /categories/115/ HTTP/1.1" 404 8793
WARNING basehttp 124 "GET /categories/115/hotskus/ HTTP/1.1" 404 8817
INFO basehttp 124 "GET /cart/ HTTP/1.1" 200 929
ERROR basehttp 124 "GET /categories/115/skus/?page=1&page_size=5&ordering=-create_time HTTP/1.1" 500 20403
解决:
# 指定过滤排序的后端
filter_backends = (OrderingFilter)
# 从路径中获取商品列表所要展示的分类
category_id = self.kwargs['category_id']
修改为
filter_backends = [OrderingFilter]
category_id = self.kwargs.get('category_id')