@treeio_login_required
@handle_response_format
def subscription_delete(request, subscription_id, response_format='html'):
 subscription = get_object_or_404(Subscription, pk=subscription_id)
 if ((not request.user.profile.has_permission(subscription, 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):
    subscription.trash = True
    subscription.save()
   else:
    subscription.delete()
   return HttpResponseRedirect(reverse('sales_index'))
  elif ('cancel' in request.POST):
   return HttpResponseRedirect(reverse('sales_subscription_view', args=[subscription.id]))
 return render_to_response('sales/subscription_delete', {'subscription': subscription}, context_instance=RequestContext(request), response_format=response_format)

@ treeio_login_required @ handle_response_format def subscription_delete ( request , subscription_id , response_format = 'html' ) : subscription = get_object_or_404 ( Subscription , pk = subscription_id ) if ( ( not request . user . profile . has_permission ( subscription , 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 ) : subscription . trash = True subscription . save ( ) else : subscription . delete ( ) return HttpResponseRedirect ( reverse ( 'sales_index' ) ) elif ( 'cancel' in request . POST ) : return HttpResponseRedirect ( reverse ( 'sales_subscription_view' , args = [ subscription . id ] ) ) return render_to_response ( 'sales/subscription_delete' , { 'subscription' : subscription } , context_instance = RequestContext ( request ) , response_format = response_format )
subscription delete .