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/invitations.py

44 lines
1.4 KiB
Python
Raw Normal View History

2018-12-10 13:13:18 +00:00
"""passbook Invite 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
2018-12-10 13:21:42 +00:00
from passbook.core.forms.invitations import InviteForm
2018-12-10 13:13:18 +00:00
from passbook.core.models import Invite
class InviteListView(AdminRequiredMixin, ListView):
2018-12-10 13:21:42 +00:00
"""Show list of all invitations"""
2018-12-10 13:13:18 +00:00
model = Invite
2018-12-10 13:21:42 +00:00
template_name = 'administration/invitation/list.html'
2018-12-10 13:13:18 +00:00
class InviteCreateView(SuccessMessageMixin, AdminRequiredMixin, CreateView):
"""Create new Invite"""
template_name = 'generic/create.html'
2018-12-10 13:21:42 +00:00
success_url = reverse_lazy('passbook_admin:invitations')
2018-12-10 13:13:18 +00:00
success_message = _('Successfully created Invite')
form_class = InviteForm
class InviteUpdateView(SuccessMessageMixin, AdminRequiredMixin, UpdateView):
2018-12-10 13:21:42 +00:00
"""Update invitation"""
2018-12-10 13:13:18 +00:00
model = Invite
template_name = 'generic/update.html'
2018-12-10 13:21:42 +00:00
success_url = reverse_lazy('passbook_admin:invitations')
2018-12-10 13:13:18 +00:00
success_message = _('Successfully updated Invite')
form_class = InviteForm
class InviteDeleteView(SuccessMessageMixin, AdminRequiredMixin, DeleteView):
2018-12-10 13:21:42 +00:00
"""Delete invitation"""
2018-12-10 13:13:18 +00:00
model = Invite
template_name = 'generic/delete.html'
2018-12-10 13:21:42 +00:00
success_url = reverse_lazy('passbook_admin:invitations')
2018-12-10 13:13:18 +00:00
success_message = _('Successfully updated Invite')