@require_POST
@permission_required('kbforums.lock_thread')
def lock_thread(request, document_slug, thread_id):
 doc = get_document(document_slug, request)
 thread = get_object_or_404(Thread, pk=thread_id, document=doc)
 thread.is_locked = (not thread.is_locked)
 log.info(('User %s set is_locked=%s on KB thread with id=%s ' % (request.user, thread.is_locked, thread.id)))
 thread.save()
 return HttpResponseRedirect(reverse('wiki.discuss.posts', args=[document_slug, thread_id]))

@ require_POST @ permission_required ( 'kbforums.lock_thread' ) def lock_thread ( request , document_slug , thread_id ) : doc = get_document ( document_slug , request ) thread = get_object_or_404 ( Thread , pk = thread_id , document = doc ) thread . is_locked = ( not thread . is_locked ) log . info ( ( 'User %s set is_locked=%s on KB thread with id=%s ' % ( request . user , thread . is_locked , thread . id ) ) ) thread . save ( ) return HttpResponseRedirect ( reverse ( 'wiki.discuss.posts' , args = [ document_slug , thread_id ] ) )
lock/unlock a thread .