expephalon/core/views/backend/generic.py

30 lines
786 B
Python
Raw Normal View History

from django.views.generic import TemplateView, ListView, CreateView, FormView, DeleteView, UpdateView
2020-06-03 15:05:18 +00:00
2020-05-21 12:54:59 +00:00
from core.mixins.auth import AdminMixin
class BackendViewMixin(AdminMixin):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
try:
context["title"] = self.title
except AttributeError:
pass
return context
class BackendTemplateView(BackendViewMixin, TemplateView):
2020-05-21 12:54:59 +00:00
pass
class BackendListView(BackendViewMixin, ListView):
2020-05-21 12:54:59 +00:00
pass
class BackendCreateView(BackendViewMixin, CreateView):
2020-05-21 12:54:59 +00:00
pass
class BackendFormView(BackendViewMixin, FormView):
2020-05-21 12:54:59 +00:00
pass
class BackendDeleteView(BackendViewMixin, DeleteView):
pass
class BackendUpdateView(BackendViewMixin, UpdateView):
2020-05-21 12:54:59 +00:00
pass