admin: remove old sources view

This commit is contained in:
Jens Langhammer 2021-02-09 16:17:48 +01:00
parent fa30755241
commit ad91abe9de
2 changed files with 4 additions and 24 deletions

View File

@ -61,7 +61,6 @@ urlpatterns = [
name="token-delete", name="token-delete",
), ),
# Sources # Sources
path("sources/", sources.SourceListView.as_view(), name="sources"),
path("sources/create/", sources.SourceCreateView.as_view(), name="source-create"), path("sources/create/", sources.SourceCreateView.as_view(), name="source-create"),
path( path(
"sources/<uuid:pk>/update/", "sources/<uuid:pk>/update/",

View File

@ -6,36 +6,17 @@ from django.contrib.auth.mixins import (
from django.contrib.messages.views import SuccessMessageMixin from django.contrib.messages.views import SuccessMessageMixin
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from guardian.mixins import PermissionListMixin, PermissionRequiredMixin from guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import ( from authentik.admin.views.utils import (
BackSuccessUrlMixin, BackSuccessUrlMixin,
DeleteMessageView, DeleteMessageView,
InheritanceCreateView, InheritanceCreateView,
InheritanceListView,
InheritanceUpdateView, InheritanceUpdateView,
SearchListMixin,
UserPaginateListMixin,
) )
from authentik.core.models import Source from authentik.core.models import Source
class SourceListView(
LoginRequiredMixin,
PermissionListMixin,
UserPaginateListMixin,
SearchListMixin,
InheritanceListView,
):
"""Show list of all sources"""
model = Source
permission_required = "authentik_core.view_source"
ordering = "name"
template_name = "administration/source/list.html"
search_fields = ["name", "slug"]
class SourceCreateView( class SourceCreateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin, BackSuccessUrlMixin,
@ -49,7 +30,7 @@ class SourceCreateView(
permission_required = "authentik_core.add_source" permission_required = "authentik_core.add_source"
template_name = "generic/create.html" template_name = "generic/create.html"
success_url = reverse_lazy("authentik_admin:sources") success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully created Source") success_message = _("Successfully created Source")
@ -66,7 +47,7 @@ class SourceUpdateView(
permission_required = "authentik_core.change_source" permission_required = "authentik_core.change_source"
template_name = "generic/update.html" template_name = "generic/update.html"
success_url = reverse_lazy("authentik_admin:sources") success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully updated Source") success_message = _("Successfully updated Source")
@ -77,5 +58,5 @@ class SourceDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteMessag
permission_required = "authentik_core.delete_source" permission_required = "authentik_core.delete_source"
template_name = "generic/delete.html" template_name = "generic/delete.html"
success_url = reverse_lazy("authentik_admin:sources") success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully deleted Source") success_message = _("Successfully deleted Source")