@login_required
def edit_thread(request, document_slug, thread_id):
 doc = get_document(document_slug, request)
 thread = get_object_or_404(Thread, pk=thread_id, document=doc)
 perm = request.user.has_perm('kbforums.change_thread')
 if (not (perm or ((thread.creator == request.user) and (not thread.is_locked)))):
  raise PermissionDenied
 if (request.method == 'GET'):
  form = EditThreadForm(instance=thread)
  return render(request, 'kbforums/edit_thread.html', {'form': form, 'document': doc, 'thread': thread})
 form = EditThreadForm(request.POST)
 if form.is_valid():
  log.warning(('User %s is editing KB thread with id=%s' % (request.user, thread.id)))
  thread.title = form.cleaned_data['title']
  thread.save()
  url = reverse('wiki.discuss.posts', args=[document_slug, thread_id])
  return HttpResponseRedirect(url)
 return render(request, 'kbforums/edit_thread.html', {'form': form, 'document': doc, 'thread': thread})

@ login_required def edit_thread ( request , document_slug , thread_id ) : doc = get_document ( document_slug , request ) thread = get_object_or_404 ( Thread , pk = thread_id , document = doc ) perm = request . user . has_perm ( 'kbforums.change_thread' ) if ( not ( perm or ( ( thread . creator == request . user ) and ( not thread . is_locked ) ) ) ) : raise PermissionDenied if ( request . method == 'GET' ) : form = EditThreadForm ( instance = thread ) return render ( request , 'kbforums/edit_thread.html' , { 'form' : form , 'document' : doc , 'thread' : thread } ) form = EditThreadForm ( request . POST ) if form . is_valid ( ) : log . warning ( ( 'User %s is editing KB thread with id=%s' % ( request . user , thread . id ) ) ) thread . title = form . cleaned_data [ 'title' ] thread . save ( ) url = reverse ( 'wiki.discuss.posts' , args = [ document_slug , thread_id ] ) return HttpResponseRedirect ( url ) return render ( request , 'kbforums/edit_thread.html' , { 'form' : form , 'document' : doc , 'thread' : thread } )
edit a thread .