예제 #1
0
파일: manage.py 프로젝트: urbalazs/weblate
def remove_project(request, project):
    obj = get_project(request, project)

    if not request.user.has_perm('project.edit', obj):
        raise PermissionDenied()

    form = DeleteForm(obj, request.POST)
    if not form.is_valid():
        show_form_errors(request, form)
        return redirect_param(obj, '#delete')

    project_removal.delay(obj.pk, request.user.pk)
    messages.success(request, _('Project was scheduled for removal.'))
    return redirect('home')
예제 #2
0
파일: manage.py 프로젝트: urbalazs/weblate
def remove_translation(request, project, component, lang):
    obj = get_translation(request, project, component, lang)

    if not request.user.has_perm('translation.delete', obj):
        raise PermissionDenied()

    form = DeleteForm(obj, request.POST)
    if not form.is_valid():
        show_form_errors(request, form)
        return redirect_param(obj, '#delete')

    obj.remove(request.user)
    messages.success(request, _('Translation has been removed.'))

    return redirect(obj.component)
예제 #3
0
파일: manage.py 프로젝트: yante/weblate
def remove_component(request, project, component):
    obj = get_component(request, project, component)

    if not request.user.has_perm("component.edit", obj):
        raise PermissionDenied()

    form = DeleteForm(obj, request.POST)
    if not form.is_valid():
        show_form_errors(request, form)
        return redirect_param(obj, "#delete")

    component_removal.delay(obj.pk, request.user.pk)
    messages.success(request,
                     _("Translation component was scheduled for removal."))

    return redirect(obj.project)
예제 #4
0
파일: manage.py 프로젝트: sr258/weblate
def remove_project(request, project):
    obj = get_project(request, project)

    if not request.user.has_perm('project.edit', obj):
        raise PermissionDenied()

    form = DeleteForm(obj, request.POST)
    if not form.is_valid():
        show_form_errors(request, form)
        return redirect_param(obj, '#delete')

    project_removal.delay(obj.pk)
    messages.success(request, _('Project was scheduled for removal.'))
    Change.objects.create(action=Change.ACTION_REMOVE_PROJECT,
                          target=obj.slug,
                          user=request.user,
                          author=request.user)

    return redirect('home')
예제 #5
0
def remove_component(request, project, component):
    obj = get_component(request, project, component)

    if not request.user.has_perm('component.edit', obj):
        raise PermissionDenied()

    form = DeleteForm(obj, request.POST)
    if not form.is_valid():
        show_form_errors(request, form)
        return redirect_param(obj, '#delete')

    obj.delete()
    messages.success(request, _('Translation component has been removed.'))
    Change.objects.create(project=obj.project,
                          action=Change.ACTION_REMOVE_COMPONENT,
                          target=obj.slug,
                          user=request.user,
                          author=request.user)

    return redirect(obj.project)