@require_POST
@login_required
def move_thread(request, forum_slug, thread_id):
 forum = get_object_or_404(Forum, slug=forum_slug)
 thread = get_object_or_404(Thread, pk=thread_id, forum=forum)
 user = request.user
 new_forum_id = request.POST.get('forum')
 new_forum = get_object_or_404(Forum, id=new_forum_id)
 if (not (forum.allows_viewing_by(user) and new_forum.allows_viewing_by(user))):
  raise Http404
 if (not new_forum.allows_posting_by(user)):
  raise PermissionDenied
 if (not (has_perm(user, 'forums_forum.thread_move_forum', new_forum) and has_perm(user, 'forums_forum.thread_move_forum', forum))):
  raise PermissionDenied
 log.warning(('User %s is moving thread with id=%s to forum with id=%s' % (user, thread.id, new_forum_id)))
 thread.forum = new_forum
 thread.save()
 return HttpResponseRedirect(thread.get_absolute_url())

@ require_POST @ login_required def move_thread ( request , forum_slug , thread_id ) : forum = get_object_or_404 ( Forum , slug = forum_slug ) thread = get_object_or_404 ( Thread , pk = thread_id , forum = forum ) user = request . user new_forum_id = request . POST . get ( 'forum' ) new_forum = get_object_or_404 ( Forum , id = new_forum_id ) if ( not ( forum . allows_viewing_by ( user ) and new_forum . allows_viewing_by ( user ) ) ) : raise Http404 if ( not new_forum . allows_posting_by ( user ) ) : raise PermissionDenied if ( not ( has_perm ( user , 'forums_forum.thread_move_forum' , new_forum ) and has_perm ( user , 'forums_forum.thread_move_forum' , forum ) ) ) : raise PermissionDenied log . warning ( ( 'User %s is moving thread with id=%s to forum with id=%s' % ( user , thread . id , new_forum_id ) ) ) thread . forum = new_forum thread . save ( ) return HttpResponseRedirect ( thread . get_absolute_url ( ) )
move a thread .