@handle_response_format
@treeio_login_required
def location_delete(request, location_id, response_format='html'):
 location = get_object_or_404(Location, pk=location_id)
 if (not request.user.profile.has_permission(location, mode='w')):
  return user_denied(request, message="You don't have write access to this Location")
 if request.POST:
  if ('delete' in request.POST):
   if ('trash' in request.POST):
    location.trash = True
    location.save()
   else:
    location.delete()
   return HttpResponseRedirect(reverse('infrastructure_index'))
  elif ('cancel' in request.POST):
   return HttpResponseRedirect(reverse('infrastructure_location_view', args=[location.id]))
 context = _get_default_context(request)
 context.update({'location': location})
 return render_to_response('infrastructure/location_delete', context, context_instance=RequestContext(request), response_format=response_format)

@ handle_response_format @ treeio_login_required def location_delete ( request , location_id , response_format = 'html' ) : location = get_object_or_404 ( Location , pk = location_id ) if ( not request . user . profile . has_permission ( location , mode = 'w' ) ) : return user_denied ( request , message = "You don't have write access to this Location" ) if request . POST : if ( 'delete' in request . POST ) : if ( 'trash' in request . POST ) : location . trash = True location . save ( ) else : location . delete ( ) return HttpResponseRedirect ( reverse ( 'infrastructure_index' ) ) elif ( 'cancel' in request . POST ) : return HttpResponseRedirect ( reverse ( 'infrastructure_location_view' , args = [ location . id ] ) ) context = _get_default_context ( request ) context . update ( { 'location' : location } ) return render_to_response ( 'infrastructure/location_delete' , context , context_instance = RequestContext ( request ) , response_format = response_format )
location delete page .