2016-11-16 06:20:44 +00:00
|
|
|
# ~*~ coding: utf-8 ~*~
|
|
|
|
from __future__ import unicode_literals
|
2016-08-08 16:43:11 +00:00
|
|
|
|
2016-11-16 06:20:44 +00:00
|
|
|
from django.conf import settings
|
|
|
|
from django.views.generic.list import ListView, MultipleObjectMixin
|
|
|
|
from django.views.generic.edit import CreateView, DeleteView, UpdateView
|
|
|
|
from django.views.generic.detail import DetailView, SingleObjectMixin
|
|
|
|
|
2016-11-23 03:45:50 +00:00
|
|
|
from users.utils import AdminUserRequiredMixin
|
2016-12-11 04:05:11 +00:00
|
|
|
from ops.utils.mixins import CreateSudoPrivilegesMixin, ListSudoPrivilegesMixin
|
|
|
|
from ops.models import *
|
2016-11-16 06:20:44 +00:00
|
|
|
|
|
|
|
|
2016-11-20 06:48:18 +00:00
|
|
|
class SudoListView(AdminUserRequiredMixin, ListSudoPrivilegesMixin, ListView):
|
2016-11-16 06:20:44 +00:00
|
|
|
paginate_by = settings.CONFIG.DISPLAY_PER_PAGE
|
2016-11-20 06:48:18 +00:00
|
|
|
model = Sudo
|
|
|
|
context_object_name = 'sudos'
|
|
|
|
template_name = 'sudo/list.html'
|
2016-11-16 06:20:44 +00:00
|
|
|
|
|
|
|
|
2016-11-20 06:48:18 +00:00
|
|
|
class SudoCreateView(AdminUserRequiredMixin, CreateSudoPrivilegesMixin, CreateView):
|
|
|
|
model = Sudo
|
|
|
|
template_name = 'sudo/create.html'
|
2016-11-16 06:20:44 +00:00
|
|
|
|
|
|
|
|
2016-11-16 07:00:46 +00:00
|
|
|
class SudoUpdateView(AdminUserRequiredMixin, UpdateView):
|
2016-11-20 06:48:18 +00:00
|
|
|
model = Sudo
|
|
|
|
template_name = 'sudo/update.html'
|
2016-11-16 06:20:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SudoDetailView(DetailView):
|
2016-11-20 06:48:18 +00:00
|
|
|
model = Sudo
|
|
|
|
context_object_name = 'sudo'
|
|
|
|
template_name = 'sudo/detail.html'
|
2016-11-16 06:20:44 +00:00
|
|
|
|
2016-11-22 13:08:45 +00:00
|
|
|
|
|
|
|
class CronListView(AdminUserRequiredMixin, ListSudoPrivilegesMixin, ListView):
|
|
|
|
paginate_by = settings.CONFIG.DISPLAY_PER_PAGE
|
|
|
|
model = CronTable
|
|
|
|
context_object_name = 'crons'
|
|
|
|
template_name = 'sudo/list.html'
|
|
|
|
|
|
|
|
|
|
|
|
class CronCreateView(AdminUserRequiredMixin, CreateSudoPrivilegesMixin, CreateView):
|
|
|
|
model = CronTable
|
|
|
|
template_name = 'cron/create.html'
|
|
|
|
|
|
|
|
|
|
|
|
class CronUpdateView(AdminUserRequiredMixin, UpdateView):
|
|
|
|
model = CronTable
|
|
|
|
template_name = 'cron/update.html'
|
|
|
|
|
|
|
|
|
|
|
|
class CronDetailView(DetailView):
|
|
|
|
model = CronTable
|
2016-11-27 03:30:23 +00:00
|
|
|
context_object_name = 'cron'
|
2016-11-22 13:08:45 +00:00
|
|
|
template_name = 'cron/detail.html'
|
|
|
|
|