jumpserver/apps/terminal/views.py

37 lines
1.1 KiB
Python
Raw Normal View History

2016-10-16 14:12:13 +00:00
# ~*~ coding: utf-8 ~*~
#
2016-10-24 11:32:53 +00:00
from django.views.generic import ListView, UpdateView, DeleteView
2016-10-16 14:12:13 +00:00
from django.utils.translation import ugettext as _
2016-10-19 10:33:14 +00:00
from django.urls import reverse_lazy
2016-10-16 14:12:13 +00:00
from .models import Terminal
2016-10-19 10:33:14 +00:00
from .forms import TerminalForm
2016-10-16 14:12:13 +00:00
class TerminalListView(ListView):
model = Terminal
2016-10-17 07:24:41 +00:00
template_name = 'terminal/terminal_list.html'
2016-10-16 14:12:13 +00:00
def get_context_data(self, **kwargs):
context = super(TerminalListView, self).get_context_data(**kwargs)
context.update({'app': _('Terminal'), 'action': _('Terminal list')})
return context
2016-10-19 10:33:14 +00:00
class TerminalUpdateView(UpdateView):
model = Terminal
form_class = TerminalForm
template_name = 'terminal/terminal_update.html'
success_url = reverse_lazy('terminal:terminal-list')
def get_context_data(self, **kwargs):
context = super(TerminalUpdateView, self).get_context_data(**kwargs)
context.update({'app': _('Terminal'), 'action': _('Update terminal')})
return context
2016-10-24 11:32:53 +00:00
class TerminalDeleteView(DeleteView):
model = Terminal
template_name = 'assets/delete_confirm.html'
success_url = reverse_lazy('terminal:terminal-list')