コード例 #1
0
def remove_team(request, team):
    if not can_remove_team(request.user, team):
        return HttpResponseRedirect(reverse('sentry'))

    if request.method == 'POST':
        form = RemoveTeamForm(request.POST)
    else:
        form = RemoveTeamForm()

    if form.is_valid():
        team.delete()
        messages.add_message(
            request, messages.SUCCESS,
            _(u'The team %r was permanently deleted.') %
            (team.name.encode('utf-8'), ))
        return HttpResponseRedirect(reverse('sentry'))

    context = csrf(request)
    context.update({
        'page': 'settings',
        'form': form,
        'SUBSECTION': 'settings',
    })

    return render_with_team_context(team, 'sentry/teams/remove.html', context,
                                    request)
コード例 #2
0
ファイル: teams.py プロジェクト: yangsensen/sentry
def remove_team(request, team):
    if not can_remove_team(request.user, team):
        return HttpResponseRedirect(reverse('sentry'))

    if request.method == 'POST':
        form = RemoveTeamForm(request.POST)
    else:
        form = RemoveTeamForm()

    if form.is_valid():
        if team.status == TeamStatus.VISIBLE:
            team.update(status=TeamStatus.PENDING_DELETION)
            # we delay the task for 5 minutes so we can implement an undo
            kwargs = {'object_id': team.id}
            delete_team.apply_async(kwargs=kwargs, countdown=60 * 5)

        messages.add_message(
            request, messages.SUCCESS,
            _('Deletion has been queued and will happen automatically.'))

        return HttpResponseRedirect(reverse('sentry'))

    context = csrf(request)
    context.update({
        'page': 'settings',
        'form': form,
        'SUBSECTION': 'settings',
    })

    return render_with_team_context(team, 'sentry/teams/remove.html', context, request)
コード例 #3
0
ファイル: teams.py プロジェクト: basco-johnkevin/sentry
def remove_team(request, team):
    if not can_remove_team(request.user, team):
        return HttpResponseRedirect(reverse('sentry'))

    if request.method == 'POST':
        form = RemoveTeamForm(request.POST)
    else:
        form = RemoveTeamForm()

    if form.is_valid():
        if team.status == TeamStatus.VISIBLE:
            team.update(status=TeamStatus.PENDING_DELETION)
            # we delay the task for 5 minutes so we can implement an undo
            kwargs = {'object_id': team.id}
            delete_team.apply_async(kwargs=kwargs, countdown=60 * 5)

        messages.add_message(
            request, messages.SUCCESS,
            _('Deletion has been queued and will happen automatically.'))

        return HttpResponseRedirect(reverse('sentry'))

    context = csrf(request)
    context.update({
        'page': 'settings',
        'form': form,
        'SUBSECTION': 'settings',
    })

    return render_with_team_context(team, 'sentry/teams/remove.html', context, request)
コード例 #4
0
ファイル: teams.py プロジェクト: pratz/sentry
def remove_team(request, team):
    if not can_remove_team(request.user, team):
        return HttpResponseRedirect(reverse("sentry"))

    form = RemoveTeamForm(request.POST or None)

    if form.is_valid():
        team.delete()
        return HttpResponseRedirect(reverse("sentry-team-list"))

    context = csrf(request)
    context.update({"page": "settings", "form": form, "team": team})

    return render_to_response("sentry/teams/remove.html", context, request)
コード例 #5
0
ファイル: teams.py プロジェクト: bgyss/sentry
def remove_team(request, team):
    if not can_remove_team(request.user, team):
        return HttpResponseRedirect(reverse('sentry'))

    form = RemoveTeamForm(request.POST or None)

    if form.is_valid():
        team.delete()
        return HttpResponseRedirect(reverse('sentry-team-list'))

    context = csrf(request)
    context.update({
        'form': form,
        'team': team,
    })

    return render_to_response('sentry/teams/remove.html', context, request)
コード例 #6
0
ファイル: teams.py プロジェクト: npk/sentry
def remove_team(request, team):
    if not can_remove_team(request.user, team):
        return HttpResponseRedirect(reverse('sentry'))

    form = RemoveTeamForm(request.POST or None)

    if form.is_valid():
        team.delete()
        return HttpResponseRedirect(reverse('sentry-team-list'))

    context = csrf(request)
    context.update({
        'form': form,
        'team': team,
    })

    return render_to_response('sentry/teams/remove.html', context, request)
コード例 #7
0
ファイル: teams.py プロジェクト: DouweM/sentry
def remove_team(request, team):
    if not can_remove_team(request.user, team):
        return HttpResponseRedirect(reverse('sentry'))

    if request.method == 'POST':
        form = RemoveTeamForm(request.POST)
    else:
        form = RemoveTeamForm()

    if form.is_valid():
        team.delete()
        return HttpResponseRedirect(reverse('sentry-team-list'))

    context = csrf(request)
    context.update({
        'page': 'settings',
        'form': form,
        'SUBSECTION': 'settings',
    })

    return render_with_team_context(team, 'sentry/teams/remove.html', context, request)
コード例 #8
0
ファイル: teams.py プロジェクト: launch73/sentry
def remove_team(request, team):
    if not can_remove_team(request.user, team):
        return HttpResponseRedirect(reverse('sentry'))

    if request.method == 'POST':
        form = RemoveTeamForm(request.POST)
    else:
        form = RemoveTeamForm()

    if form.is_valid():
        team.delete()
        return HttpResponseRedirect(reverse('sentry-team-list'))

    context = csrf(request)
    context.update({
        'page': 'settings',
        'form': form,
        'SUBSECTION': 'settings',
    })

    return render_with_team_context(team, 'sentry/teams/remove.html', context, request)
コード例 #9
0
ファイル: teams.py プロジェクト: SmashingDevelopment/sentry
def remove_team(request, team):
    if not can_remove_team(request.user, team):
        return HttpResponseRedirect(reverse('sentry'))

    if request.method == 'POST':
        form = RemoveTeamForm(request.POST)
    else:
        form = RemoveTeamForm()

    if form.is_valid():
        team.delete()
        messages.add_message(
            request, messages.SUCCESS,
            _(u'The team %r was permanently deleted.') % (team.name.encode('utf-8'),))
        return HttpResponseRedirect(reverse('sentry'))

    context = csrf(request)
    context.update({
        'page': 'settings',
        'form': form,
        'SUBSECTION': 'settings',
    })

    return render_with_team_context(team, 'sentry/teams/remove.html', context, request)