@login_required
def project_redirects_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)
 redirect = get_object_or_404(project.redirects, pk=request.POST.get('id_pk'))
 if (redirect.project == project):
  redirect.delete()
 else:
  raise Http404
 return HttpResponseRedirect(reverse('projects_redirects', args=[project.slug]))

@ login_required def project_redirects_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 ) redirect = get_object_or_404 ( project . redirects , pk = request . POST . get ( 'id_pk' ) ) if ( redirect . project == project ) : redirect . delete ( ) else : raise Http404 return HttpResponseRedirect ( reverse ( 'projects_redirects' , args = [ project . slug ] ) )
project redirect delete view .