Skip to content

Commit

Permalink
feat: upgrade list_report_downloads api to DRF ( 13th ) (#35350)
Browse files Browse the repository at this point in the history
* feat: upgrading simple api to drf compatible.
  • Loading branch information
awais786 authored Sep 9, 2024
1 parent a75dd0e commit 7292cab
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions lms/djangoapps/instructor/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2540,16 +2540,22 @@ def get(self, request, course_id):
return _list_report_downloads(request=request, course_id=course_id)


@require_POST
@ensure_csrf_cookie
def list_report_downloads(request, course_id):
@method_decorator(cache_control(no_cache=True, no_store=True, must_revalidate=True), name='dispatch')
class ListReportDownloads(APIView):

"""
List grade CSV files that are available for download for this course.
Takes the following query parameters:
- (optional) report_name - name of the report
"""
return _list_report_downloads(request=request, course_id=course_id)
permission_classes = (IsAuthenticated, permissions.InstructorPermission)
permission_name = permissions.CAN_RESEARCH

@method_decorator(ensure_csrf_cookie)
def post(self, request, course_id):

return _list_report_downloads(request=request, course_id=course_id)


@cache_control(no_cache=True, no_store=True, must_revalidate=True)
Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/instructor/views/api_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
path('get_proctored_exam_results', api.get_proctored_exam_results, name='get_proctored_exam_results'),

# Grade downloads...
path('list_report_downloads', api.list_report_downloads, name='list_report_downloads'),
path('list_report_downloads', api.ListReportDownloads.as_view(), name='list_report_downloads'),
path('calculate_grades_csv', api.calculate_grades_csv, name='calculate_grades_csv'),
path('problem_grade_report', api.problem_grade_report, name='problem_grade_report'),

Expand Down

0 comments on commit 7292cab

Please sign in to comment.