@treeio_login_required
@handle_response_format
def source_delete(request, source_id, response_format='html'):
 source = get_object_or_404(SaleSource, pk=source_id)
 if ((not request.user.profile.has_permission(source, 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):
    source.trash = True
    source.save()
   else:
    source.delete()
   return HttpResponseRedirect(reverse('sales_settings_view'))
  elif ('cancel' in request.POST):
   return HttpResponseRedirect(reverse('sales_source_view', args=[source.id]))
 all_products = Object.filter_by_request(request, Product.objects.filter(parent__isnull=True))
 all_sources = Object.filter_by_request(request, SaleSource.objects)
 return render_to_response('sales/source_delete', {'source': source, 'sources': all_sources, 'products': all_products}, context_instance=RequestContext(request), response_format=response_format)

@ treeio_login_required @ handle_response_format def source_delete ( request , source_id , response_format = 'html' ) : source = get_object_or_404 ( SaleSource , pk = source_id ) if ( ( not request . user . profile . has_permission ( source , 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 ) : source . trash = True source . save ( ) else : source . delete ( ) return HttpResponseRedirect ( reverse ( 'sales_settings_view' ) ) elif ( 'cancel' in request . POST ) : return HttpResponseRedirect ( reverse ( 'sales_source_view' , args = [ source . id ] ) ) all_products = Object . filter_by_request ( request , Product . objects . filter ( parent__isnull = True ) ) all_sources = Object . filter_by_request ( request , SaleSource . objects ) return render_to_response ( 'sales/source_delete' , { 'source' : source , 'sources' : all_sources , 'products' : all_products } , context_instance = RequestContext ( request ) , response_format = response_format )
salesource delete .