When I request for order that contains multiple order items and after filter data from the database at the time of return response my order item id gets changed it contains id that even didn't exits in the database.
def list_order_by_entrepreneur_view(request):
order = Order.objects.distinct().filter(orderitem__entrepreneur_id=request.data['entrepreneur_id'],
orderitem__status=request.data['status'])
serializer = ListOrderSerializer(order, many=True)
for order in serializer.data:
for order_item in order['order_items']:
print(order_item['order_item_id'])
return Response(serializer.data)
In the above printing statement it will return the correct order item ids like this
41750862938521900
48770276682006700
64456048092798900
94735086015354602
94735086015354601
14875991458541102
14875991458541101
84042205998714300
But when I return the response to client side then the id '94735086015354601' will convert to '94735086015354610' and same for id '94735086015354602'. I don't know why.