@handle_response_format
@treeio_login_required
def category_edit(request, knowledgeCategory_id, response_format='html'):
 category = get_object_or_404(KnowledgeCategory, pk=knowledgeCategory_id)
 items = Object.filter_permitted(manager=KnowledgeItem.objects, user=request.user.profile, mode='r')
 if (not request.user.profile.has_permission(category, mode='w')):
  return user_denied(request, message="You don't have access to this Knowledge Category")
 if request.POST:
  if ('cancel' not in request.POST):
   form = KnowledgeCategoryForm(request.POST, instance=category)
   if form.is_valid():
    category = form.save()
    return HttpResponseRedirect(reverse('knowledge_category_view', args=[category.treepath]))
  else:
   return HttpResponseRedirect(reverse('knowledge_category_view', args=[category.treepath]))
 else:
  form = KnowledgeCategoryForm(instance=category)
 context = _get_default_context(request)
 context.update({'form': form, 'category': category, 'items': items})
 return render_to_response('knowledge/category_edit', context, context_instance=RequestContext(request), response_format=response_format)

@ handle_response_format @ treeio_login_required def category_edit ( request , knowledgeCategory_id , response_format = 'html' ) : category = get_object_or_404 ( KnowledgeCategory , pk = knowledgeCategory_id ) items = Object . filter_permitted ( manager = KnowledgeItem . objects , user = request . user . profile , mode = 'r' ) if ( not request . user . profile . has_permission ( category , mode = 'w' ) ) : return user_denied ( request , message = "You don't have access to this Knowledge Category" ) if request . POST : if ( 'cancel' not in request . POST ) : form = KnowledgeCategoryForm ( request . POST , instance = category ) if form . is_valid ( ) : category = form . save ( ) return HttpResponseRedirect ( reverse ( 'knowledge_category_view' , args = [ category . treepath ] ) ) else : return HttpResponseRedirect ( reverse ( 'knowledge_category_view' , args = [ category . treepath ] ) ) else : form = KnowledgeCategoryForm ( instance = category ) context = _get_default_context ( request ) context . update ( { 'form' : form , 'category' : category , 'items' : items } ) return render_to_response ( 'knowledge/category_edit' , context , context_instance = RequestContext ( request ) , response_format = response_format )
category edit page .