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
|
|
|
|
2016-12-14 01:54:16 +00:00
|
|
|
class CronListView(AdminUserRequiredMixin, ListView):
|
2016-11-22 13:08:45 +00:00
|
|
|
paginate_by = settings.CONFIG.DISPLAY_PER_PAGE
|
|
|
|
model = CronTable
|
|
|
|
context_object_name = 'crons'
|
2016-12-14 01:54:16 +00:00
|
|
|
template_name = 'cron/list.html'
|
2016-11-22 13:08:45 +00:00
|
|
|
|
|
|
|
|
2016-12-14 01:54:16 +00:00
|
|
|
class CronCreateView(AdminUserRequiredMixin, CreateView):
|
2016-11-22 13:08:45 +00:00
|
|
|
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'
|
|
|
|
|
2016-12-19 06:07:21 +00:00
|
|
|
class TaskListView(AdminUserRequiredMixin, ListView):
|
|
|
|
paginate_by = settings.CONFIG.DISPLAY_PER_PAGE
|
|
|
|
model = Task
|
|
|
|
context_object_name = 'tasks'
|
|
|
|
template_name = 'task/list.html'
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs):
|
|
|
|
context = {
|
|
|
|
'task': 'Assets',
|
|
|
|
'action': 'Create asset',
|
|
|
|
}
|
|
|
|
kwargs.update(context)
|
|
|
|
return super(TaskListView, self).get_context_data(**kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
class TaskCreateView(AdminUserRequiredMixin, CreateView):
|
|
|
|
model = Task
|
|
|
|
template_name = 'task/create.html'
|
|
|
|
|
|
|
|
|
|
|
|
class TaskUpdateView(AdminUserRequiredMixin, UpdateView):
|
|
|
|
model = Task
|
|
|
|
template_name = 'task/update.html'
|
|
|
|
|
|
|
|
|
|
|
|
class TaskDetailView(DetailView):
|
|
|
|
model = Task
|
|
|
|
context_object_name = 'task'
|
|
|
|
template_name = 'task/detail.html'
|