@handle_response_format
@treeio_login_required
def project_delete(request, project_id, response_format='html'):
 project = get_object_or_404(Project, pk=project_id)
 if (not request.user.profile.has_permission(project, mode='w')):
  return user_denied(request, message="You don't have access to this Project")
 if request.POST:
  if ('delete' in request.POST):
   if ('trash' in request.POST):
    project.trash = True
    project.save()
   else:
    project.delete()
   return HttpResponseRedirect(reverse('projects_index'))
  elif ('cancel' in request.POST):
   return HttpResponseRedirect(reverse('projects_project_view', args=[project.id]))
 context = _get_default_context(request)
 context.update({'project': project})
 return render_to_response('projects/project_delete', context, context_instance=RequestContext(request), response_format=response_format)

@ handle_response_format @ treeio_login_required def project_delete ( request , project_id , response_format = 'html' ) : project = get_object_or_404 ( Project , pk = project_id ) if ( not request . user . profile . has_permission ( project , mode = 'w' ) ) : return user_denied ( request , message = "You don't have access to this Project" ) if request . POST : if ( 'delete' in request . POST ) : if ( 'trash' in request . POST ) : project . trash = True project . save ( ) else : project . delete ( ) return HttpResponseRedirect ( reverse ( 'projects_index' ) ) elif ( 'cancel' in request . POST ) : return HttpResponseRedirect ( reverse ( 'projects_project_view' , args = [ project . id ] ) ) context = _get_default_context ( request ) context . update ( { 'project' : project } ) return render_to_response ( 'projects/project_delete' , context , context_instance = RequestContext ( request ) , response_format = response_format )
project delete confirmation view make a project as deleted on post .