From 61a8d95f46feb89e78a5e39d30efae38a936426e Mon Sep 17 00:00:00 2001 From: ibuler Date: Fri, 1 Dec 2017 17:28:47 +0800 Subject: [PATCH] [Change] Rename applications -> terminal --- apps/applications/migrations/__init__.py | 0 apps/audits/hands.py | 2 +- apps/common/celery.py | 2 +- apps/jumpserver/middleware.py | 2 +- apps/jumpserver/settings.py | 6 +++--- apps/jumpserver/urls.py | 4 ++-- apps/templates/_nav.html | 6 +++--- apps/{applications => terminal}/__init__.py | 0 apps/{applications => terminal}/admin.py | 0 apps/{applications => terminal}/api.py | 14 +++++++------- apps/{applications => terminal}/apps.py | 2 +- .../backends/__init__.py | 0 .../backends/command/__init__.py | 0 .../backends/command/base.py | 0 .../backends/command/db.py | 4 ++-- .../backends/command/models.py | 0 .../backends/command/serializers.py | 0 .../backends/replay/__init__.py | 0 .../backends/replay/base.py | 0 .../backends/replay/db.py | 0 .../backends/replay/serializers.py | 0 apps/{applications => terminal}/forms.py | 0 apps/{applications => terminal}/hands.py | 0 apps/{applications => terminal}/models.py | 11 ++++++----- apps/{applications => terminal}/serializers.py | 10 +++++----- apps/{applications => terminal}/tasks.py | 0 .../templates/terminal}/terminal_detail.html | 0 .../templates/terminal}/terminal_list.html | 12 ++++++------ .../terminal}/terminal_modal_accept.html | 2 +- .../terminal}/terminal_modal_test.html | 0 .../templates/terminal}/terminal_update.html | 0 apps/{applications => terminal}/tests.py | 0 .../urls/__init__.py | 0 .../urls/api_urls.py | 2 +- .../urls/views_urls.py | 2 +- apps/{applications => terminal}/views.py | 18 +++++++++--------- apps/users/hands.py | 2 +- 37 files changed, 51 insertions(+), 50 deletions(-) delete mode 100644 apps/applications/migrations/__init__.py rename apps/{applications => terminal}/__init__.py (100%) rename apps/{applications => terminal}/admin.py (100%) rename apps/{applications => terminal}/api.py (94%) rename apps/{applications => terminal}/apps.py (81%) rename apps/{applications => terminal}/backends/__init__.py (100%) rename apps/{applications => terminal}/backends/command/__init__.py (100%) rename apps/{applications => terminal}/backends/command/base.py (100%) rename apps/{applications => terminal}/backends/command/db.py (95%) rename apps/{applications => terminal}/backends/command/models.py (100%) rename apps/{applications => terminal}/backends/command/serializers.py (100%) rename apps/{applications => terminal}/backends/replay/__init__.py (100%) rename apps/{applications => terminal}/backends/replay/base.py (100%) rename apps/{applications => terminal}/backends/replay/db.py (100%) rename apps/{applications => terminal}/backends/replay/serializers.py (100%) rename apps/{applications => terminal}/forms.py (100%) rename apps/{applications => terminal}/hands.py (100%) rename apps/{applications => terminal}/models.py (95%) rename apps/{applications => terminal}/serializers.py (81%) rename apps/{applications => terminal}/tasks.py (100%) rename apps/{applications/templates/applications => terminal/templates/terminal}/terminal_detail.html (100%) rename apps/{applications/templates/applications => terminal/templates/terminal}/terminal_list.html (90%) rename apps/{applications/templates/applications => terminal/templates/terminal}/terminal_modal_accept.html (74%) rename apps/{applications/templates/applications => terminal/templates/terminal}/terminal_modal_test.html (100%) rename apps/{applications/templates/applications => terminal/templates/terminal}/terminal_update.html (100%) rename apps/{applications => terminal}/tests.py (100%) rename apps/{applications => terminal}/urls/__init__.py (100%) rename apps/{applications => terminal}/urls/api_urls.py (96%) rename apps/{applications => terminal}/urls/views_urls.py (96%) rename apps/{applications => terminal}/views.py (85%) diff --git a/apps/applications/migrations/__init__.py b/apps/applications/migrations/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/apps/audits/hands.py b/apps/audits/hands.py index 13986a2c8..11ba2e765 100644 --- a/apps/audits/hands.py +++ b/apps/audits/hands.py @@ -5,4 +5,4 @@ from users.utils import AdminUserRequiredMixin from users.models import User from assets.models import Asset, SystemUser from users.permissions import IsSuperUserOrAppUser, IsAppUser -from applications.models import Terminal +from terminal.models import Terminal diff --git a/apps/common/celery.py b/apps/common/celery.py index a30b5af7c..18b5f755d 100644 --- a/apps/common/celery.py +++ b/apps/common/celery.py @@ -33,7 +33,7 @@ app.conf.update( 'args': (), }, 'clean_terminal_history': { - 'task': 'applications.tasks.clean_terminal_history', + 'task': 'terminal.tasks.clean_terminal_history', 'schedule': 60*60*60, 'args': (), } diff --git a/apps/jumpserver/middleware.py b/apps/jumpserver/middleware.py index e2ac5c346..28e718d7d 100644 --- a/apps/jumpserver/middleware.py +++ b/apps/jumpserver/middleware.py @@ -9,7 +9,7 @@ from django.shortcuts import HttpResponse DEMO_MODE = os.environ.get("DEMO_MODE", "") -SAFE_URL = r'^/users/login|^/api/applications/v1/.*|/api/audits/.*|/api/users/v1/auth/|/api/users/v1/profile/' +SAFE_URL = r'^/users/login|^/api/terminal/v1/.*|/api/audits/.*|/api/users/v1/auth/|/api/users/v1/profile/' class TimezoneMiddleware(MiddlewareMixin): diff --git a/apps/jumpserver/settings.py b/apps/jumpserver/settings.py index 066dc679f..00290db0d 100644 --- a/apps/jumpserver/settings.py +++ b/apps/jumpserver/settings.py @@ -61,7 +61,7 @@ INSTALLED_APPS = [ 'ops.apps.OpsConfig', 'audits.apps.AuditsConfig', 'common.apps.CommonConfig', - 'applications.apps.ApplicationsConfig', + 'terminal.apps.ApplicationsConfig', 'rest_framework', 'rest_framework_swagger', 'django_filters', @@ -363,8 +363,8 @@ CAPTCHA_FOREGROUND_COLOR = '#001100' CAPTCHA_NOISE_FUNCTIONS = ('captcha.helpers.noise_dots',) CAPTCHA_TEST_MODE = CONFIG.CAPTCHA_TEST_MODE -COMMAND_STORE_BACKEND = 'applications.backends.command.db' -RECORD_STORE_BACKEND = 'applications.backends.replay.db' +COMMAND_STORE_BACKEND = 'terminal.backends.command.db' +RECORD_STORE_BACKEND = 'terminal.backends.replay.db' # Django bootstrap3 setting, more see http://django-bootstrap3.readthedocs.io/en/latest/settings.html diff --git a/apps/jumpserver/urls.py b/apps/jumpserver/urls.py index de74984a8..80e8df1f2 100644 --- a/apps/jumpserver/urls.py +++ b/apps/jumpserver/urls.py @@ -17,7 +17,7 @@ urlpatterns = [ url(r'^assets/', include('assets.urls.views_urls', namespace='assets')), url(r'^perms/', include('perms.urls.views_urls', namespace='perms')), url(r'^audits/', include('audits.urls.views_urls', namespace='audits')), - url(r'^applications/', include('applications.urls.views_urls', namespace='applications')), + url(r'^terminal/', include('terminal.urls.views_urls', namespace='terminal')), url(r'^ops/', include('ops.urls.view_urls', namespace='ops')), # Api url view map @@ -25,7 +25,7 @@ urlpatterns = [ url(r'^api/assets/', include('assets.urls.api_urls', namespace='api-assets')), url(r'^api/perms/', include('perms.urls.api_urls', namespace='api-perms')), url(r'^api/audits/', include('audits.urls.api_urls', namespace='api-audits')), - url(r'^api/applications/', include('applications.urls.api_urls', namespace='api-applications')), + url(r'^api/terminal/', include('terminal.urls.api_urls', namespace='api-terminal')), url(r'^api/ops/', include('ops.urls.api_urls', namespace='api-ops')), url(r'^captcha/', include('captcha.urls')), diff --git a/apps/templates/_nav.html b/apps/templates/_nav.html index 020268f35..b36085466 100644 --- a/apps/templates/_nav.html +++ b/apps/templates/_nav.html @@ -34,12 +34,12 @@ -
  • +
  • - {% trans 'Applications' %} + {% trans 'Terminal' %}
  • diff --git a/apps/applications/__init__.py b/apps/terminal/__init__.py similarity index 100% rename from apps/applications/__init__.py rename to apps/terminal/__init__.py diff --git a/apps/applications/admin.py b/apps/terminal/admin.py similarity index 100% rename from apps/applications/admin.py rename to apps/terminal/admin.py diff --git a/apps/applications/api.py b/apps/terminal/api.py similarity index 94% rename from apps/applications/api.py rename to apps/terminal/api.py index c8499b06b..96b092c13 100644 --- a/apps/applications/api.py +++ b/apps/terminal/api.py @@ -15,7 +15,7 @@ from django.utils import timezone from django.conf import settings from common.utils import get_object_or_none -from .models import Terminal, TerminalStatus, TerminalSession, TerminalTask +from .models import Terminal, Status, Session, Task from .serializers import TerminalSerializer, TerminalStatusSerializer, \ TerminalSessionSerializer, TerminalTaskSerializer from .hands import IsSuperUserOrAppUser, IsAppUser, ProxyLog, \ @@ -65,7 +65,7 @@ class TerminalViewSet(viewsets.ModelViewSet): class TerminalStatusViewSet(viewsets.ModelViewSet): - queryset = TerminalStatus.objects.all() + queryset = Status.objects.all() serializer_class = TerminalStatusSerializer permission_classes = (IsSuperUserOrAppUser,) session_serializer_class = TerminalSessionSerializer @@ -79,7 +79,7 @@ class TerminalStatusViewSet(viewsets.ModelViewSet): for session_data in self.request.data.get("sessions", []): session_data["terminal"] = self.request.user.terminal.id _id = session_data["id"] - session = get_object_or_none(TerminalSession, id=_id) + session = get_object_or_none(Session, id=_id) if session: serializer = TerminalSessionSerializer(data=session_data, instance=session) @@ -95,7 +95,7 @@ class TerminalStatusViewSet(viewsets.ModelViewSet): if not session_data["is_finished"]: sessions_active.append(session_data["id"]) - sessions_in_db_active = TerminalSession.objects.filter( + sessions_in_db_active = Session.objects.filter( is_finished=False, terminal=self.request.user.terminal.id ) @@ -123,7 +123,7 @@ class TerminalStatusViewSet(viewsets.ModelViewSet): class TerminalSessionViewSet(viewsets.ModelViewSet): - queryset = TerminalSession.objects.all() + queryset = Session.objects.all() serializers_class = TerminalSessionSerializer permission_classes = (IsSuperUserOrAppUser,) @@ -136,7 +136,7 @@ class TerminalSessionViewSet(viewsets.ModelViewSet): class TerminalTaskViewSet(viewsets.ModelViewSet): - queryset = TerminalTask.objects.all() + queryset = Task.objects.all() serializer_class = TerminalTaskSerializer permission_classes = (IsSuperUserOrAppUser,) @@ -157,7 +157,7 @@ class SessionReplayAPI(APIView): def post(self, request, **kwargs): session_id = kwargs.get("pk", None) - session = get_object_or_404(TerminalSession, id=session_id) + session = get_object_or_404(Session, id=session_id) record_dir = settings.CONFIG.SESSION_RECORDE_DIR date = session.date_start.strftime("%Y-%m-%d") record_dir = os.path.join(record_dir, date, str(session.id)) diff --git a/apps/applications/apps.py b/apps/terminal/apps.py similarity index 81% rename from apps/applications/apps.py rename to apps/terminal/apps.py index 3c22ddedc..aae1c57b5 100644 --- a/apps/applications/apps.py +++ b/apps/terminal/apps.py @@ -4,4 +4,4 @@ from django.apps import AppConfig class ApplicationsConfig(AppConfig): - name = 'applications' + name = 'terminal' diff --git a/apps/applications/backends/__init__.py b/apps/terminal/backends/__init__.py similarity index 100% rename from apps/applications/backends/__init__.py rename to apps/terminal/backends/__init__.py diff --git a/apps/applications/backends/command/__init__.py b/apps/terminal/backends/command/__init__.py similarity index 100% rename from apps/applications/backends/command/__init__.py rename to apps/terminal/backends/command/__init__.py diff --git a/apps/applications/backends/command/base.py b/apps/terminal/backends/command/base.py similarity index 100% rename from apps/applications/backends/command/base.py rename to apps/terminal/backends/command/base.py diff --git a/apps/applications/backends/command/db.py b/apps/terminal/backends/command/db.py similarity index 95% rename from apps/applications/backends/command/db.py rename to apps/terminal/backends/command/db.py index 1d7219e9d..3034d374b 100644 --- a/apps/applications/backends/command/db.py +++ b/apps/terminal/backends/command/db.py @@ -9,8 +9,8 @@ from .base import CommandBase class CommandStore(CommandBase): def __init__(self): - from applications.models import SessionCommand - self.model = SessionCommand + from terminal.models import Command + self.model = Command def save(self, command): """ diff --git a/apps/applications/backends/command/models.py b/apps/terminal/backends/command/models.py similarity index 100% rename from apps/applications/backends/command/models.py rename to apps/terminal/backends/command/models.py diff --git a/apps/applications/backends/command/serializers.py b/apps/terminal/backends/command/serializers.py similarity index 100% rename from apps/applications/backends/command/serializers.py rename to apps/terminal/backends/command/serializers.py diff --git a/apps/applications/backends/replay/__init__.py b/apps/terminal/backends/replay/__init__.py similarity index 100% rename from apps/applications/backends/replay/__init__.py rename to apps/terminal/backends/replay/__init__.py diff --git a/apps/applications/backends/replay/base.py b/apps/terminal/backends/replay/base.py similarity index 100% rename from apps/applications/backends/replay/base.py rename to apps/terminal/backends/replay/base.py diff --git a/apps/applications/backends/replay/db.py b/apps/terminal/backends/replay/db.py similarity index 100% rename from apps/applications/backends/replay/db.py rename to apps/terminal/backends/replay/db.py diff --git a/apps/applications/backends/replay/serializers.py b/apps/terminal/backends/replay/serializers.py similarity index 100% rename from apps/applications/backends/replay/serializers.py rename to apps/terminal/backends/replay/serializers.py diff --git a/apps/applications/forms.py b/apps/terminal/forms.py similarity index 100% rename from apps/applications/forms.py rename to apps/terminal/forms.py diff --git a/apps/applications/hands.py b/apps/terminal/hands.py similarity index 100% rename from apps/applications/hands.py rename to apps/terminal/hands.py diff --git a/apps/applications/models.py b/apps/terminal/models.py similarity index 95% rename from apps/applications/models.py rename to apps/terminal/models.py index 569b81516..e7643e5b4 100644 --- a/apps/applications/models.py +++ b/apps/terminal/models.py @@ -58,9 +58,10 @@ class Terminal(models.Model): class Meta: ordering = ('is_accepted',) + db_table = "terminal" -class TerminalStatus(models.Model): +class Status(models.Model): id = models.UUIDField(default=uuid.uuid4, primary_key=True) session_online = models.IntegerField(verbose_name=_("Session Online"), default=0) cpu_used = models.FloatField(verbose_name=_("CPU Usage")) @@ -75,7 +76,7 @@ class TerminalStatus(models.Model): db_table = 'terminal_status' -class TerminalSession(models.Model): +class Session(models.Model): LOGIN_FROM_CHOICES = ( ('ST', 'SSH Terminal'), ('WT', 'Web Terminal'), @@ -100,7 +101,7 @@ class TerminalSession(models.Model): return "{0.id} of {0.user} to {0.asset}".format(self) -class TerminalTask(models.Model): +class Task(models.Model): id = models.UUIDField(default=uuid.uuid4, primary_key=True) name = models.CharField(max_length=128, verbose_name=_("Name")) args = models.CharField(max_length=1024, verbose_name=_("Task Args")) @@ -113,7 +114,7 @@ class TerminalTask(models.Model): db_table = "terminal_task" -class SessionCommand(AbstractSessionCommand): +class Command(AbstractSessionCommand): class Meta: - db_table = "session_command" + db_table = "terminal_command" diff --git a/apps/applications/serializers.py b/apps/terminal/serializers.py similarity index 81% rename from apps/applications/serializers.py rename to apps/terminal/serializers.py index 03667a369..1f6dc22c2 100644 --- a/apps/applications/serializers.py +++ b/apps/terminal/serializers.py @@ -4,7 +4,7 @@ from django.utils import timezone from rest_framework import serializers -from .models import Terminal, TerminalStatus, TerminalSession, TerminalTask +from .models import Terminal, Status, Session, Task from .hands import ProxyLog @@ -19,7 +19,7 @@ class TerminalSerializer(serializers.ModelSerializer): @staticmethod def get_session_connected(obj): - return TerminalSession.objects.filter(terminal=obj.id, is_finished=False) + return Session.objects.filter(terminal=obj.id, is_finished=False) @staticmethod def get_is_alive(obj): @@ -33,7 +33,7 @@ class TerminalSerializer(serializers.ModelSerializer): class TerminalSessionSerializer(serializers.ModelSerializer): class Meta: - model = TerminalSession + model = Session fields = '__all__' @@ -41,11 +41,11 @@ class TerminalStatusSerializer(serializers.ModelSerializer): class Meta: fields = '__all__' - model = TerminalStatus + model = Status class TerminalTaskSerializer(serializers.ModelSerializer): class Meta: fields = '__all__' - model = TerminalTask + model = Task diff --git a/apps/applications/tasks.py b/apps/terminal/tasks.py similarity index 100% rename from apps/applications/tasks.py rename to apps/terminal/tasks.py diff --git a/apps/applications/templates/applications/terminal_detail.html b/apps/terminal/templates/terminal/terminal_detail.html similarity index 100% rename from apps/applications/templates/applications/terminal_detail.html rename to apps/terminal/templates/terminal/terminal_detail.html diff --git a/apps/applications/templates/applications/terminal_list.html b/apps/terminal/templates/terminal/terminal_list.html similarity index 90% rename from apps/applications/templates/applications/terminal_list.html rename to apps/terminal/templates/terminal/terminal_list.html index a34ab88d7..0cb09d54b 100644 --- a/apps/applications/templates/applications/terminal_list.html +++ b/apps/terminal/templates/terminal/terminal_list.html @@ -39,7 +39,7 @@ -{% include 'applications/terminal_modal_accept.html' %} +{% include 'terminal/terminal_modal_accept.html' %} {% endblock %} {% block custom_foot_js %} @@ -51,7 +51,7 @@ $(document).ready(function(){ buttons: [], columnDefs: [ {targets: 1, createdCell: function (td, cellData, rowData) { - var detail_btn = '' + cellData + ''; + var detail_btn = '' + cellData + ''; $(td).html(detail_btn.replace('99991937', rowData.id)); }}, {targets: 6, createdCell: function (td, cellData) { @@ -69,7 +69,7 @@ $(document).ready(function(){ } }}, {targets: 8, createdCell: function (td, cellData, rowData) { - var update_btn = '{% trans "Update" %}' + var update_btn = '{% trans "Update" %}' .replace('99991937', cellData); var delete_btn = '{% trans "Delete" %}' .replace('99991937', cellData) @@ -94,7 +94,7 @@ $(document).ready(function(){ } }} ], - ajax_url: '{% url "api-applications:terminal-list" %}', + ajax_url: '{% url "api-terminal:terminal-list" %}', columns: [{data: function(){return ""}}, {data: "name" }, {data: "remote_addr" }, {data: "ssh_port"}, {data: "http_port"}, {data: "session_connected"}, {data: "is_accepted" }, {data: 'is_alive'}, {data: "id"}], op_html: $('#actions').html() @@ -117,13 +117,13 @@ $(document).ready(function(){ var $this = $(this); var id = $this.data('id'); var name = $(this).data('name'); - var the_url = '{% url "api-applications:terminal-detail" pk=99991937 %}'.replace('99991937', id); + var the_url = '{% url "api-terminal:terminal-detail" pk=99991937 %}'.replace('99991937', id); objectDelete($this, name, the_url) }).on('click', '.btn-accept', function () { var $this = $(this); var terminal_id = $this.data('id'); - var the_url = "{% url 'api-applications:terminal-detail' pk=99991937 %}".replace('99991937', terminal_id); + var the_url = "{% url 'api-terminal:terminal-detail' pk=99991937 %}".replace('99991937', terminal_id); var post_url = $('#form_terminal_accept').attr('action').replace('99991937', terminal_id); console.log(post_url); $.ajax({ diff --git a/apps/applications/templates/applications/terminal_modal_accept.html b/apps/terminal/templates/terminal/terminal_modal_accept.html similarity index 74% rename from apps/applications/templates/applications/terminal_modal_accept.html rename to apps/terminal/templates/terminal/terminal_modal_accept.html index 50789a3a0..b5fc9bfdb 100644 --- a/apps/applications/templates/applications/terminal_modal_accept.html +++ b/apps/terminal/templates/terminal/terminal_modal_accept.html @@ -5,7 +5,7 @@ {% block modal_title%}{% trans "Accept terminal registration" %}{% endblock %} {% block modal_body %} {% load bootstrap3 %} -
    + {% csrf_token %} {% bootstrap_field form.name layout="horizontal" %} diff --git a/apps/applications/templates/applications/terminal_modal_test.html b/apps/terminal/templates/terminal/terminal_modal_test.html similarity index 100% rename from apps/applications/templates/applications/terminal_modal_test.html rename to apps/terminal/templates/terminal/terminal_modal_test.html diff --git a/apps/applications/templates/applications/terminal_update.html b/apps/terminal/templates/terminal/terminal_update.html similarity index 100% rename from apps/applications/templates/applications/terminal_update.html rename to apps/terminal/templates/terminal/terminal_update.html diff --git a/apps/applications/tests.py b/apps/terminal/tests.py similarity index 100% rename from apps/applications/tests.py rename to apps/terminal/tests.py diff --git a/apps/applications/urls/__init__.py b/apps/terminal/urls/__init__.py similarity index 100% rename from apps/applications/urls/__init__.py rename to apps/terminal/urls/__init__.py diff --git a/apps/applications/urls/api_urls.py b/apps/terminal/urls/api_urls.py similarity index 96% rename from apps/applications/urls/api_urls.py rename to apps/terminal/urls/api_urls.py index d5924e060..c3f7f2123 100644 --- a/apps/applications/urls/api_urls.py +++ b/apps/terminal/urls/api_urls.py @@ -7,7 +7,7 @@ from rest_framework import routers from .. import api -app_name = 'applications' +app_name = 'terminal' router = routers.DefaultRouter() router.register(r'v1/terminal/(?P[0-9]+)?/?status', api.TerminalStatusViewSet, 'terminal-status') diff --git a/apps/applications/urls/views_urls.py b/apps/terminal/urls/views_urls.py similarity index 96% rename from apps/applications/urls/views_urls.py rename to apps/terminal/urls/views_urls.py index 8b5ff745f..3525e944d 100644 --- a/apps/applications/urls/views_urls.py +++ b/apps/terminal/urls/views_urls.py @@ -6,7 +6,7 @@ from django.conf.urls import url from .. import views -app_name = 'applications' +app_name = 'terminal' urlpatterns = [ url(r'^terminal/$', views.TerminalListView.as_view(), name='terminal-list'), diff --git a/apps/applications/views.py b/apps/terminal/views.py similarity index 85% rename from apps/applications/views.py rename to apps/terminal/views.py index f3ac66659..fbef30912 100644 --- a/apps/applications/views.py +++ b/apps/terminal/views.py @@ -15,7 +15,7 @@ from .hands import AdminUserRequiredMixin class TerminalListView(LoginRequiredMixin, ListView): model = Terminal - template_name = 'applications/terminal_list.html' + template_name = 'terminal/terminal_list.html' form_class = TerminalForm def get_context_data(self, **kwargs): @@ -31,24 +31,24 @@ class TerminalListView(LoginRequiredMixin, ListView): class TerminalUpdateView(AdminUserRequiredMixin, UpdateView): model = Terminal form_class = TerminalForm - template_name = 'applications/terminal_update.html' - success_url = reverse_lazy('applications:terminal-list') + 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': _('Applications'), 'action': _('Update terminal')}) + context.update({'app': _('Terminal'), 'action': _('Update terminal')}) return context class TerminalDetailView(LoginRequiredMixin, DetailView): model = Terminal - template_name = 'applications/terminal_detail.html' + template_name = 'terminal/terminal_detail.html' context_object_name = 'terminal' def get_context_data(self, **kwargs): context = super(TerminalDetailView, self).get_context_data(**kwargs) context.update({ - 'app': _('Applications'), + 'app': _('Terminal'), 'action': _('Terminal detail') }) return context @@ -57,13 +57,13 @@ class TerminalDetailView(LoginRequiredMixin, DetailView): class TerminalDeleteView(AdminUserRequiredMixin, DeleteView): model = Terminal template_name = 'assets/delete_confirm.html' - success_url = reverse_lazy('applications:applications-list') + success_url = reverse_lazy('terminal:terminal-list') class TerminalModelAccept(AdminUserRequiredMixin, JSONResponseMixin, UpdateView): model = Terminal form_class = TerminalForm - template_name = 'applications/terminal_modal_test.html' + template_name = 'Terminal/terminal_modal_test.html' def form_valid(self, form): terminal = form.save() @@ -103,7 +103,7 @@ class TerminalConnectView(LoginRequiredMixin, DetailView): 'messages': _('You should use your ssh client tools ' 'connect terminal: {}

    ' '{}'.format(self.object.name, self.object.url)), - 'redirect_url': reverse('applications:terminal-list') + 'redirect_url': reverse('terminal:terminal-list') } kwargs.update(context) diff --git a/apps/users/hands.py b/apps/users/hands.py index 7fc963bcd..b44b9bb84 100644 --- a/apps/users/hands.py +++ b/apps/users/hands.py @@ -10,7 +10,7 @@ :license: GPL v2, see LICENSE for more details. """ -from applications.models import Terminal +from terminal.models import Terminal from audits.tasks import write_login_log_async from users.models import User # from perms.models import AssetPermission