added delete report SQL call

This commit is contained in:
Rupika 2019-02-09 15:39:48 -08:00
parent e315355e81
commit c0768aaed3

View file

@ -2,7 +2,6 @@ from rest_framework.decorators import api_view
from django.http import JsonResponse from django.http import JsonResponse
from .models import * from .models import *
from .policy import pol from .policy import pol
import ntpath
# function that prints all the reports # function that prints all the reports
@ -134,6 +133,7 @@ def report_detail(request, report_pk):
# Delete the report # Delete the report
elif request.method == 'DELETE': elif request.method == 'DELETE':
Report.objects.filter(id=report_pk).delete()
return JsonResponse({"message": "Deleted report {0}.".format(report_pk)}) return JsonResponse({"message": "Deleted report {0}.".format(report_pk)})