コード例 #1
0
def lock_translation(request, project, subproject, lang):
    obj = get_translation(request, project, subproject, lang)

    if not can_lock_subproject(request.user, obj.subproject.project):
        raise PermissionDenied()

    if not obj.is_user_locked(request.user):
        obj.create_lock(request.user, True)
        messages.success(request, _('Translation is now locked for you.'))

    return redirect(obj)
コード例 #2
0
def unlock_subproject(request, project, subproject):
    obj = get_subproject(request, project, subproject)

    if not can_lock_subproject(request.user, obj.project):
        raise PermissionDenied()

    obj.do_unlock(request.user)

    messages.success(request,
                     _('Component is now open for translation updates.'))

    return redirect(obj)
コード例 #3
0
def unlock_project(request, project):
    obj = get_project(request, project)

    if not can_lock_subproject(request.user, obj):
        raise PermissionDenied()

    for subproject in obj.subproject_set.all():
        subproject.do_unlock(request.user)

    messages.success(request,
                     _('Project is now open for translation updates.'))

    return redirect(obj)
コード例 #4
0
ファイル: lock.py プロジェクト: Acidburn0zzz/weblate
def unlock_subproject(request, project, subproject):
    obj = get_subproject(request, project, subproject)

    if not can_lock_subproject(request.user, obj.project):
        raise PermissionDenied()

    obj.do_unlock(request.user)

    messages.success(
        request,
        _('Component is now open for translation updates.')
    )

    return redirect(obj)
コード例 #5
0
def lock_subproject(request, project, subproject):
    obj = get_subproject(request, project, subproject)

    if not can_lock_subproject(request.user, obj.project):
        raise PermissionDenied()

    obj.commit_pending(request)

    obj.do_lock(request.user)

    messages.success(request,
                     _('Component is now locked for translation updates!'))

    return redirect(obj)
コード例 #6
0
ファイル: lock.py プロジェクト: Acidburn0zzz/weblate
def unlock_project(request, project):
    obj = get_project(request, project)

    if not can_lock_subproject(request.user, obj):
        raise PermissionDenied()

    for subproject in obj.subproject_set.all():
        subproject.do_unlock(request.user)

    messages.success(
        request,
        _('Project is now open for translation updates.')
    )

    return redirect(obj)
コード例 #7
0
def lock_project(request, project):
    obj = get_project(request, project)

    if not can_lock_subproject(request.user, obj):
        raise PermissionDenied()

    obj.commit_pending(request)

    for subproject in obj.subproject_set.all():
        subproject.do_lock(request.user)

    messages.success(
        request, _('All components are now locked for translation updates!'))

    return redirect(obj)
コード例 #8
0
ファイル: lock.py プロジェクト: Acidburn0zzz/weblate
def lock_subproject(request, project, subproject):
    obj = get_subproject(request, project, subproject)

    if not can_lock_subproject(request.user, obj.project):
        raise PermissionDenied()

    obj.commit_pending(request)

    obj.do_lock(request.user)

    messages.success(
        request,
        _('Component is now locked for translation updates!')
    )

    return redirect(obj)
コード例 #9
0
ファイル: views.py プロジェクト: AlfredWei/weblate
    def lock(self, request, **kwargs):
        obj = self.get_object()

        if request.method == 'POST':
            if not can_lock_subproject(request.user, obj.project):
                raise PermissionDenied()

            serializer = LockRequestSerializer(data=request.data)
            serializer.is_valid(raise_exception=True)

            if serializer.validated_data['lock']:
                obj.do_lock(request.user)
            else:
                obj.do_unlock(request.user)

        return Response(data=LockSerializer(obj).data)
コード例 #10
0
ファイル: views.py プロジェクト: unhammer/weblate
    def lock(self, request, **kwargs):
        obj = self.get_object()

        if request.method == 'POST':
            if not can_lock_subproject(request.user, obj.project):
                raise PermissionDenied()

            serializer = LockRequestSerializer(data=request.data)
            serializer.is_valid(raise_exception=True)

            if serializer.validated_data['lock']:
                obj.do_lock(request.user)
            else:
                obj.do_unlock(request.user)

        return Response(data=LockSerializer(obj).data)
コード例 #11
0
ファイル: lock.py プロジェクト: Acidburn0zzz/weblate
def lock_project(request, project):
    obj = get_project(request, project)

    if not can_lock_subproject(request.user, obj):
        raise PermissionDenied()

    obj.commit_pending(request)

    for subproject in obj.subproject_set.all():
        subproject.do_lock(request.user)

    messages.success(
        request,
        _('All components are now locked for translation updates!')
    )

    return redirect(obj)