@handle_response_format
@treeio_login_required
def folder_edit(request, knowledgeType_id, response_format='html'):
 folder = get_object_or_404(KnowledgeFolder, pk=knowledgeType_id)
 items = Object.filter_by_request(request, manager=KnowledgeItem.objects.filter(folder=folder))
 if (not request.user.profile.has_permission(folder, mode='w')):
  return user_denied(request, message="You don't have access to this Knowledge Type")
 if request.POST:
  if ('cancel' not in request.POST):
   form = KnowledgeFolderForm(request.user.profile, None, request.POST, instance=folder)
   if form.is_valid():
    folder = form.save()
    return HttpResponseRedirect(reverse('knowledge_folder_view', args=[folder.treepath]))
  else:
   return HttpResponseRedirect(reverse('knowledge_folder_view', args=[folder.treepath]))
 else:
  form = KnowledgeFolderForm(request.user.profile, None, instance=folder)
 context = _get_default_context(request)
 context.update({'items': items, 'folder': folder, 'form': form})
 return render_to_response('knowledge/folder_edit', context, context_instance=RequestContext(request), response_format=response_format)

@ handle_response_format @ treeio_login_required def folder_edit ( request , knowledgeType_id , response_format = 'html' ) : folder = get_object_or_404 ( KnowledgeFolder , pk = knowledgeType_id ) items = Object . filter_by_request ( request , manager = KnowledgeItem . objects . filter ( folder = folder ) ) if ( not request . user . profile . has_permission ( folder , mode = 'w' ) ) : return user_denied ( request , message = "You don't have access to this Knowledge Type" ) if request . POST : if ( 'cancel' not in request . POST ) : form = KnowledgeFolderForm ( request . user . profile , None , request . POST , instance = folder ) if form . is_valid ( ) : folder = form . save ( ) return HttpResponseRedirect ( reverse ( 'knowledge_folder_view' , args = [ folder . treepath ] ) ) else : return HttpResponseRedirect ( reverse ( 'knowledge_folder_view' , args = [ folder . treepath ] ) ) else : form = KnowledgeFolderForm ( request . user . profile , None , instance = folder ) context = _get_default_context ( request ) context . update ( { 'items' : items , 'folder' : folder , 'form' : form } ) return render_to_response ( 'knowledge/folder_edit' , context , context_instance = RequestContext ( request ) , response_format = response_format )
folder edit page .