Simplified section update API endpoint.

This commit is contained in:
kououken 2019-03-09 12:59:19 -08:00
parent 7716ab7480
commit 9faf653432
3 changed files with 3 additions and 3 deletions

View file

@ -9,7 +9,7 @@ urlpatterns = [
path('reports', views.reports),
path('report/<int:report_pk>', views.report_detail),
path('report/<int:report_pk>/final', views.finalize_report),
path('report/<int:report_pk>/section/<int:section_pk>', views.section),
path('section/<int:section_pk>', views.section),
]
urlpatterns = format_suffix_patterns(urlpatterns)

View file

@ -270,7 +270,7 @@ def user_owns_section(user, section_id):
return report_to_check.user_id == user
@api_view(['PUT'])
def section(request, report_pk, section_pk):
def section(request, section_pk):
"""
Updates the specified section with new data.

View file

@ -606,7 +606,7 @@ document.addEventListener("submit", function(event) {
let saveButton = event.target.lastElementChild;
animateButton(saveButton, " Saving...");
const formData = new FormData(event.target);
const url = getEndpointDomain() + "api/v1/report/" + event.target.dataset.rid + "/section/" + event.target.dataset.sid;
const url = getEndpointDomain() + "api/v1/section/" + event.target.dataset.sid;
makeAjaxRequest("PUT", url, updateSection, saveButton, formData);
}
});