@login_required
def project_notifications_delete(request, project_slug):
 if (request.method != 'POST'):
  return HttpResponseNotAllowed('Only POST is allowed')
 project = get_object_or_404(Project.objects.for_admin_user(request.user), slug=project_slug)
 try:
  project.emailhook_notifications.get(email=request.POST.get('email')).delete()
 except EmailHook.DoesNotExist:
  try:
   project.webhook_notifications.get(url=request.POST.get('email')).delete()
  except WebHook.DoesNotExist:
   raise Http404
 project_dashboard = reverse('projects_notifications', args=[project.slug])
 return HttpResponseRedirect(project_dashboard)

@ login_required def project_notifications_delete ( request , project_slug ) : if ( request . method != 'POST' ) : return HttpResponseNotAllowed ( 'Only POST is allowed' ) project = get_object_or_404 ( Project . objects . for_admin_user ( request . user ) , slug = project_slug ) try : project . emailhook_notifications . get ( email = request . POST . get ( 'email' ) ) . delete ( ) except EmailHook . DoesNotExist : try : project . webhook_notifications . get ( url = request . POST . get ( 'email' ) ) . delete ( ) except WebHook . DoesNotExist : raise Http404 project_dashboard = reverse ( 'projects_notifications' , args = [ project . slug ] ) return HttpResponseRedirect ( project_dashboard )
project notifications delete confirmation view .