Printing Multiple Items Using Serializer March 11, 2024 Post a Comment @api_view(['GET']) def selected_device(request,pk=None): if pk != None: devices = Device.objects.filter(pk=pk) devicedetail = DeviceDetail.objects.filter(DD2DKESolution 1: You writefor i in interfaces: data = [{"interface": i}] Copywhich means you keep on overwriting data with a new value. I think you want:data = [] for i in interfaces: data.append({"interface": i}) Copyor more simplydata = [{"interace": i} for i in interfaces] Copy Share Post a Comment for "Printing Multiple Items Using Serializer"
Post a Comment for "Printing Multiple Items Using Serializer"