Simplified section update API endpoint.
This commit is contained in:
parent
7716ab7480
commit
9faf653432
3 changed files with 3 additions and 3 deletions
|
@ -9,7 +9,7 @@ urlpatterns = [
|
||||||
path('reports', views.reports),
|
path('reports', views.reports),
|
||||||
path('report/<int:report_pk>', views.report_detail),
|
path('report/<int:report_pk>', views.report_detail),
|
||||||
path('report/<int:report_pk>/final', views.finalize_report),
|
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)
|
urlpatterns = format_suffix_patterns(urlpatterns)
|
||||||
|
|
|
@ -270,7 +270,7 @@ def user_owns_section(user, section_id):
|
||||||
return report_to_check.user_id == user
|
return report_to_check.user_id == user
|
||||||
|
|
||||||
@api_view(['PUT'])
|
@api_view(['PUT'])
|
||||||
def section(request, report_pk, section_pk):
|
def section(request, section_pk):
|
||||||
"""
|
"""
|
||||||
Updates the specified section with new data.
|
Updates the specified section with new data.
|
||||||
|
|
||||||
|
|
|
@ -606,7 +606,7 @@ document.addEventListener("submit", function(event) {
|
||||||
let saveButton = event.target.lastElementChild;
|
let saveButton = event.target.lastElementChild;
|
||||||
animateButton(saveButton, " Saving...");
|
animateButton(saveButton, " Saving...");
|
||||||
const formData = new FormData(event.target);
|
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);
|
makeAjaxRequest("PUT", url, updateSection, saveButton, formData);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue