@require_POST
@login_required
@permitted
def openclose_thread(request, course_id, thread_id):
 course_key = CourseKey.from_string(course_id)
 thread = cc.Thread.find(thread_id)
 thread.closed = (request.POST.get('closed', 'false').lower() == 'true')
 thread.save()
 return JsonResponse({'content': prepare_content(thread.to_dict(), course_key), 'ability': get_ability(course_key, thread.to_dict(), request.user)})

@ require_POST @ login_required @ permitted def openclose_thread ( request , course_id , thread_id ) : course_key = CourseKey . from_string ( course_id ) thread = cc . Thread . find ( thread_id ) thread . closed = ( request . POST . get ( 'closed' , 'false' ) . lower ( ) == 'true' ) thread . save ( ) return JsonResponse ( { 'content' : prepare_content ( thread . to_dict ( ) , course_key ) , 'ability' : get_ability ( course_key , thread . to_dict ( ) , request . user ) } )
given a course_id and thread_id .