Changeset View
Changeset View
Standalone View
Standalone View
swh/web/misc/origin_save.py
# Copyright (C) 2018-2021 The Software Heritage developers | # Copyright (C) 2018-2021 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU Affero General Public License version 3, or any later version | # License: GNU Affero General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
from django.conf.urls import url | from django.conf.urls import url | ||||
from django.core.paginator import Paginator | from django.core.paginator import Paginator | ||||
from django.db.models import Q | from django.db.models import Q | ||||
from django.http import JsonResponse | from django.http import JsonResponse | ||||
from django.shortcuts import render | from django.shortcuts import render | ||||
from swh.web.auth.utils import privileged_user | from swh.web.auth.utils import SWH_AMBASSADOR_PERMISSION, privileged_user | ||||
from swh.web.common.models import SaveOriginRequest | from swh.web.common.models import SaveOriginRequest | ||||
from swh.web.common.origin_save import ( | from swh.web.common.origin_save import ( | ||||
get_savable_visit_types, | get_savable_visit_types, | ||||
get_save_origin_task_info, | get_save_origin_task_info, | ||||
) | ) | ||||
def _origin_save_view(request): | def _origin_save_view(request): | ||||
return render( | return render( | ||||
request, | request, | ||||
"misc/origin-save.html", | "misc/origin-save.html", | ||||
{ | { | ||||
"heading": ("Request the saving of a software origin into the archive"), | "heading": ("Request the saving of a software origin into the archive"), | ||||
"visit_types": get_savable_visit_types(privileged_user(request)), | "visit_types": get_savable_visit_types( | ||||
privileged_user(request, permissions=[SWH_AMBASSADOR_PERMISSION]) | |||||
), | |||||
}, | }, | ||||
) | ) | ||||
def _origin_save_requests_list(request, status): | def _origin_save_requests_list(request, status): | ||||
if status != "all": | if status != "all": | ||||
save_requests = SaveOriginRequest.objects.filter(status=status) | save_requests = SaveOriginRequest.objects.filter(status=status) | ||||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |