Answer the question
In order to leave comments, you need to log in
How to delete records after request in django?
Hello everyone, how in django, after receiving the data, delete them from the table?
If I do as in the code (commented out part), then an empty array is returned.
class CrmReceiptView(APIView):
def get(self, request):
if 'kkt_id' not in request.GET:
return Response({'message': 'Не указан ID кассы'}, status=status.HTTP_400_BAD_REQUEST)
else:
receipts = CrmReceipt.objects.filter(kkt=CrmKKT.objects.get(id=request.GET['kkt_id']))
serializer = CrmReceiptSerializer(receipts, many=True)
#receipts.delete()
return Response(serializer.data)
Answer the question
In order to leave comments, you need to log in
CrmReceipt.objects.filter(kkt=CrmKKT.objects.get(id=request.GET['kkt_id']))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question