def lock_translation(request, project, subproject, lang): obj = get_translation(request, project, subproject, lang) if not can_lock_translation(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)