@treeio_login_required
@handle_response_format
def lead_delete(request, lead_id, response_format='html'):
 lead = get_object_or_404(Lead, pk=lead_id)
 if ((not request.user.profile.has_permission(lead, mode='w')) and (not request.user.profile.is_admin('treeio.sales'))):
  return user_denied(request, "You don't have access to this Sale Status", response_format)
 if request.POST:
  if ('delete' in request.POST):
   if ('trash' in request.POST):
    lead.trash = True
    lead.save()
   else:
    lead.delete()
   return HttpResponseRedirect(reverse('sales_lead_index'))
  elif ('cancel' in request.POST):
   return HttpResponseRedirect(reverse('sales_lead_view', args=[lead.id]))
 all_products = Object.filter_by_request(request, Product.objects.filter(parent__isnull=True))
 all_leads = Object.filter_by_request(request, Lead.objects)
 return render_to_response('sales/lead_delete', {'lead': lead, 'leads': all_leads, 'products': all_products}, context_instance=RequestContext(request), response_format=response_format)

@ treeio_login_required @ handle_response_format def lead_delete ( request , lead_id , response_format = 'html' ) : lead = get_object_or_404 ( Lead , pk = lead_id ) if ( ( not request . user . profile . has_permission ( lead , mode = 'w' ) ) and ( not request . user . profile . is_admin ( 'treeio.sales' ) ) ) : return user_denied ( request , "You don't have access to this Sale Status" , response_format ) if request . POST : if ( 'delete' in request . POST ) : if ( 'trash' in request . POST ) : lead . trash = True lead . save ( ) else : lead . delete ( ) return HttpResponseRedirect ( reverse ( 'sales_lead_index' ) ) elif ( 'cancel' in request . POST ) : return HttpResponseRedirect ( reverse ( 'sales_lead_view' , args = [ lead . id ] ) ) all_products = Object . filter_by_request ( request , Product . objects . filter ( parent__isnull = True ) ) all_leads = Object . filter_by_request ( request , Lead . objects ) return render_to_response ( 'sales/lead_delete' , { 'lead' : lead , 'leads' : all_leads , 'products' : all_products } , context_instance = RequestContext ( request ) , response_format = response_format )
lead delete .