권주희

Merge branch 'feature/item_api' into 'develop'

add get item api



See merge request !7
...@@ -57,8 +57,12 @@ class ItemViewSet(viewsets.ViewSet): ...@@ -57,8 +57,12 @@ class ItemViewSet(viewsets.ViewSet):
57 # url: items/11/ 57 # url: items/11/
58 # 마지막 slash도 써주어야함 58 # 마지막 slash도 써주어야함
59 def get(self, request, pk): 59 def get(self, request, pk):
60 - print(pk) 60 + item = Item.objects.filter(item_id=pk)
61 - return Response({'message': "info complete"}, status=status.HTTP_200_OK) 61 + data = serializers.serialize("json", item)
62 + json_data = json.loads(data)
63 + res = json_data[0]['fields']
64 + res['id']=json_data[0]['pk']
65 + return Response({'data': res}, status=status.HTTP_200_OK)
62 66
63 # url: items/11/ 67 # url: items/11/
64 # 마지막 slash도 써주어야함 68 # 마지막 slash도 써주어야함
......