@treeio_login_required
@handle_response_format
def event_delete(request, event_id, response_format='html'):
 event = get_object_or_404(Event, pk=event_id)
 if (not request.user.profile.has_permission(event, mode='w')):
  return user_denied(request, message="You don't have access to this Event")
 if request.POST:
  if ('delete' in request.POST):
   if ('trash' in request.POST):
    event.trash = True
    event.save()
   else:
    event.delete()
   return HttpResponseRedirect(reverse('events_index'))
  elif ('cancel' in request.POST):
   return HttpResponseRedirect(reverse('events_event_view', args=[event.id]))
 return render_to_response('events/event_delete', {'event': event}, context_instance=RequestContext(request), response_format=response_format)

@ treeio_login_required @ handle_response_format def event_delete ( request , event_id , response_format = 'html' ) : event = get_object_or_404 ( Event , pk = event_id ) if ( not request . user . profile . has_permission ( event , mode = 'w' ) ) : return user_denied ( request , message = "You don't have access to this Event" ) if request . POST : if ( 'delete' in request . POST ) : if ( 'trash' in request . POST ) : event . trash = True event . save ( ) else : event . delete ( ) return HttpResponseRedirect ( reverse ( 'events_index' ) ) elif ( 'cancel' in request . POST ) : return HttpResponseRedirect ( reverse ( 'events_event_view' , args = [ event . id ] ) ) return render_to_response ( 'events/event_delete' , { 'event' : event } , context_instance = RequestContext ( request ) , response_format = response_format )
event delete .