@handle_response_format
@treeio_login_required
def weblink_delete(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 ('delete' in request.POST):
   if ('trash' in request.POST):
    link.trash = True
    link.save()
   else:
    link.delete()
   return HttpResponseRedirect(reverse('document_index'))
  elif ('cancel' in request.POST):
   return HttpResponseRedirect(reverse('documents_weblink_view', args=[link.id]))
 context = _get_default_context(request)
 context.update({'link': link})
 return render_to_response('documents/weblink_delete', context, context_instance=RequestContext(request), response_format=response_format)

@ handle_response_format @ treeio_login_required def weblink_delete ( 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 ( 'delete' in request . POST ) : if ( 'trash' in request . POST ) : link . trash = True link . save ( ) else : link . delete ( ) return HttpResponseRedirect ( reverse ( 'document_index' ) ) elif ( 'cancel' in request . POST ) : return HttpResponseRedirect ( reverse ( 'documents_weblink_view' , args = [ link . id ] ) ) context = _get_default_context ( request ) context . update ( { 'link' : link } ) return render_to_response ( 'documents/weblink_delete' , context , context_instance = RequestContext ( request ) , response_format = response_format )
weblink delete .