@handle_response_format
@treeio_login_required
def weblink_edit(request, weblink_id, response_format='html'):
 link = get_object_or_404(WebLink, pk=weblink_id)
 if (not request.user.profile.has_permission(link, mode='w')):
  return user_denied(request, message="You don't have access to this Web Link")
 if request.POST:
  if ('cancel' not in request.POST):
   form = WebLinkForm(request.user.profile, None, request.POST, instance=link)
   if form.is_valid():
    link = form.save()
    return HttpResponseRedirect(reverse('documents_weblink_view', args=[link.id]))
  else:
   return HttpResponseRedirect(reverse('documents_weblink_view', args=[link.id]))
 else:
  form = WebLinkForm(request.user.profile, None, instance=link)
 context = _get_default_context(request)
 context.update({'form': form, 'link': link})
 return render_to_response('documents/weblink_edit', context, context_instance=RequestContext(request), response_format=response_format)

@ handle_response_format @ treeio_login_required def weblink_edit ( request , weblink_id , response_format = 'html' ) : link = get_object_or_404 ( WebLink , pk = weblink_id ) if ( not request . user . profile . has_permission ( link , mode = 'w' ) ) : return user_denied ( request , message = "You don't have access to this Web Link" ) if request . POST : if ( 'cancel' not in request . POST ) : form = WebLinkForm ( request . user . profile , None , request . POST , instance = link ) if form . is_valid ( ) : link = form . save ( ) return HttpResponseRedirect ( reverse ( 'documents_weblink_view' , args = [ link . id ] ) ) else : return HttpResponseRedirect ( reverse ( 'documents_weblink_view' , args = [ link . id ] ) ) else : form = WebLinkForm ( request . user . profile , None , instance = link ) context = _get_default_context ( request ) context . update ( { 'form' : form , 'link' : link } ) return render_to_response ( 'documents/weblink_edit' , context , context_instance = RequestContext ( request ) , response_format = response_format )
weblink edit page .