Merge pull request #66 from danieldupriest/delete_report_api

Delete report api
This commit is contained in:
ppdom 2019-02-10 13:32:47 -08:00 committed by GitHub
commit 639fdcec8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View file

@ -78,7 +78,7 @@ pol.add_section(flight_section)
lodging_section = Section( lodging_section = Section(
title="Hotel Info", title="Hotel Info",
html_description="<p>Enter hotel info here.\nPer diem rates can be found at " html_description="<p>Enter hotel info here.\nPer diem rates can be found at "
"<a href='https://www.gsa.gov/travel/plan-book/per-diem-rates'></a></p>", "<a href='https://www.gsa.gov/travel/plan-book/per-diem-rates'>this link</a></p>",
fields={ fields={
"check-in_date": {"label": "Check-in date", "type": "date"}, "check-in_date": {"label": "Check-in date", "type": "date"},
"check-out_date": {"label": "Check-out date", "type": "date"}, "check-out_date": {"label": "Check-out date", "type": "date"},
@ -124,7 +124,8 @@ pol.add_section(transport_section)
#### Section 4 #### Section 4
per_diem_section = Section( per_diem_section = Section(
title="Per Diem", title="Per Diem",
html_description="<p>Enter info about meals and incidentals here.\nPer diem rates can be found at <a href='https://www.gsa.gov/travel/plan-book/per-diem-rates'></a></p>", html_description="<p>Enter info about meals and incidentals here.\nPer diem rates can be found at "
"<a href='https://www.gsa.gov/travel/plan-book/per-diem-rates'>this link</a></p>",
fields={ fields={
"duration": {"label": "How many days was your trip?", "type": "decimal"}, "duration": {"label": "How many days was your trip?", "type": "decimal"},
"rate": {"label": "What is the per diem rate for your destination?", "type": "decimal"}, "rate": {"label": "What is the per diem rate for your destination?", "type": "decimal"},

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)})

Binary file not shown.