@require_POST
@api_view(['POST'])
@ensure_csrf_cookie
@login_required
@cache_control(no_cache=True, no_store=True, must_revalidate=True)
def get_course_threads(request):
from lms.djangoapps.discussion.rest_api.api import (
get_thread_list,
get_comment_list
)
course_key = CourseKey.from_string(request.POST.get('course_id'))
a=get_thread_list(request, course_key , page=1, page_size=100)
comments=[]
for temp in a.data['results']:
temp2=get_comment_list(request, temp["id"], endorsed=None, page=1, page_size=100).data
comments.append(temp2)
print(temp["id"])
payload = JsonResponse({
'status': 'success',
'r': a.data,
'comments': comments
})
return payload
Post Views: 1,568