This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/passbook/admin/views/applications.py
2018-11-26 22:08:18 +01:00

50 lines
1.6 KiB
Python

"""passbook Application administration"""
from django.contrib.messages.views import SuccessMessageMixin
from django.urls import reverse_lazy
from django.utils.translation import ugettext as _
from django.views.generic import CreateView, DeleteView, ListView, UpdateView
from passbook.admin.mixins import AdminRequiredMixin
from passbook.core.forms.applications import ApplicationForm
from passbook.core.models import Application
class ApplicationListView(AdminRequiredMixin, ListView):
"""Show list of all applications"""
model = Application
template_name = 'administration/application/list.html'
def get_queryset(self):
return super().get_queryset().select_subclasses()
class ApplicationCreateView(SuccessMessageMixin, AdminRequiredMixin, CreateView):
"""Create new Application"""
form_class = ApplicationForm
template_name = 'generic/create.html'
success_url = reverse_lazy('passbook_admin:applications')
success_message = _('Successfully created Application')
class ApplicationUpdateView(SuccessMessageMixin, AdminRequiredMixin, UpdateView):
"""Update application"""
model = Application
form_class = ApplicationForm
template_name = 'generic/update.html'
success_url = reverse_lazy('passbook_admin:applications')
success_message = _('Successfully updated Application')
class ApplicationDeleteView(SuccessMessageMixin, AdminRequiredMixin, DeleteView):
"""Delete application"""
model = Application
success_url = reverse_lazy('passbook_admin:applications')
success_message = _('Successfully updated Application')