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')
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)
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)
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)
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')
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)
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')
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)