From 3f8ae1f84ce54d02b1f3ea1c7a3c71c70336510d Mon Sep 17 00:00:00 2001 From: Nicolas Marcq Date: Tue, 26 Sep 2023 16:16:47 +0200 Subject: [PATCH] optimize imports --- .../api/serializers/permission_serializers.py | 3 +- profiles/api/views/permission_api_views.py | 3 +- profiles/api/views/quota_api_views.py | 1 - profiles/api/views/scope_api_views.py | 2 -- profiles/apps.py | 1 - profiles/filters/permission_filter.py | 2 +- profiles/forms/model_permission_form.py | 3 +- profiles/forms/permission_form.py | 3 +- profiles/models/quota.py | 1 - profiles/models/role.py | 2 +- profiles/models/team.py | 1 + profiles/tables/permission_table.py | 3 +- profiles/tables/quota_table.py | 2 +- profiles/views/globalpermission.py | 2 -- profiles/views/permission.py | 2 +- profiles/views/scope.py | 2 +- resource_tracker_v2/forms/transformer_form.py | 2 +- .../commands/import_resource_tracker_v1.py | 2 +- resource_tracker_v2/tables/resource_table.py | 4 +-- .../views/attribute_definition_views.py | 1 - .../views/resource_group_views.py | 1 - .../serializers/approval_step_serializer.py | 2 -- .../approval_step_state_serializer.py | 2 +- .../api/views/approval_step_api_views.py | 4 +-- .../api/views/operation_api_views.py | 1 - .../api/views/operation_survey_api_views.py | 4 +-- .../views/request_state_machine_api_view.py | 1 + service_catalog/filters/instance_filter.py | 4 +-- service_catalog/forms/approval_step_form.py | 2 +- service_catalog/forms/form_generator.py | 1 - service_catalog/forms/tower_server_forms.py | 1 + service_catalog/mail_utils.py | 1 - service_catalog/models/approval_step.py | 8 ++--- service_catalog/models/hooks.py | 3 +- service_catalog/models/instance.py | 4 +-- service_catalog/models/operations.py | 2 +- service_catalog/models/request.py | 3 +- service_catalog/models/support.py | 5 ++- service_catalog/models/tower_survey_field.py | 31 +++++++++---------- service_catalog/tables/instance_tables.py | 1 - service_catalog/tables/tower_server_tables.py | 1 - service_catalog/views/filters.py | 2 +- service_catalog/views/job_template.py | 5 ++- 43 files changed, 52 insertions(+), 79 deletions(-) diff --git a/profiles/api/serializers/permission_serializers.py b/profiles/api/serializers/permission_serializers.py index 0499276ae..a7549abf8 100644 --- a/profiles/api/serializers/permission_serializers.py +++ b/profiles/api/serializers/permission_serializers.py @@ -1,7 +1,6 @@ -from profiles.models.squest_permission import Permission from rest_framework.serializers import ModelSerializer -from profiles.api.serializers import ContentTypeSerializer +from profiles.models.squest_permission import Permission class PermissionSerializer(ModelSerializer): diff --git a/profiles/api/views/permission_api_views.py b/profiles/api/views/permission_api_views.py index 81b15c9cd..ae5518145 100644 --- a/profiles/api/views/permission_api_views.py +++ b/profiles/api/views/permission_api_views.py @@ -1,8 +1,7 @@ -from profiles.models.squest_permission import Permission - from Squest.utils.squest_api_views import SquestRetrieveUpdateDestroyAPIView, SquestListCreateAPIView from profiles.api.serializers import PermissionSerializer from profiles.filters import PermissionFilter +from profiles.models.squest_permission import Permission class PermissionDetails(SquestRetrieveUpdateDestroyAPIView): diff --git a/profiles/api/views/quota_api_views.py b/profiles/api/views/quota_api_views.py index 99cebd242..82b1a65ca 100644 --- a/profiles/api/views/quota_api_views.py +++ b/profiles/api/views/quota_api_views.py @@ -8,7 +8,6 @@ from profiles.models import Quota - class SquestObjectPermissionsQuota(SquestObjectPermissions): """ Custom permission to only allow owners of an object to edit it. diff --git a/profiles/api/views/scope_api_views.py b/profiles/api/views/scope_api_views.py index de6620575..aaf498bd6 100644 --- a/profiles/api/views/scope_api_views.py +++ b/profiles/api/views/scope_api_views.py @@ -1,10 +1,8 @@ from django.contrib.auth.models import User from django.views.generic import RedirectView from rest_framework.exceptions import MethodNotAllowed -from rest_framework.exceptions import NotFound from rest_framework.generics import get_object_or_404 from rest_framework.permissions import IsAuthenticated -from rest_framework.reverse import reverse from Squest.utils.squest_api_views import SquestCreateAPIView, SquestDestroyAPIView, SquestObjectPermissions from profiles.api.serializers import AbstractScopeCreateRBACSerializer diff --git a/profiles/apps.py b/profiles/apps.py index e799e20a2..e1844ae20 100644 --- a/profiles/apps.py +++ b/profiles/apps.py @@ -3,7 +3,6 @@ from django.apps import AppConfig from django.db.models.signals import post_migrate - logger = logging.getLogger(__name__) diff --git a/profiles/filters/permission_filter.py b/profiles/filters/permission_filter.py index 14aee6260..2688c6e41 100644 --- a/profiles/filters/permission_filter.py +++ b/profiles/filters/permission_filter.py @@ -1,6 +1,6 @@ +from Squest.utils.squest_filter import SquestFilter from profiles.models.squest_permission import Permission -from Squest.utils.squest_filter import SquestFilter class PermissionFilter(SquestFilter): class Meta: diff --git a/profiles/forms/model_permission_form.py b/profiles/forms/model_permission_form.py index 747b266ee..f1a4b0186 100644 --- a/profiles/forms/model_permission_form.py +++ b/profiles/forms/model_permission_form.py @@ -1,6 +1,5 @@ -from profiles.models.squest_permission import Permission - from Squest.utils.squest_model_form import SquestModelForm +from profiles.models.squest_permission import Permission class ModelPermissionForm(SquestModelForm): diff --git a/profiles/forms/permission_form.py b/profiles/forms/permission_form.py index a4bdda143..0a643f94e 100644 --- a/profiles/forms/permission_form.py +++ b/profiles/forms/permission_form.py @@ -1,6 +1,5 @@ -from profiles.models.squest_permission import Permission - from Squest.utils.squest_model_form import SquestModelForm +from profiles.models.squest_permission import Permission class PermissionForm(SquestModelForm): diff --git a/profiles/models/quota.py b/profiles/models/quota.py index bced00680..eb1eb91ad 100644 --- a/profiles/models/quota.py +++ b/profiles/models/quota.py @@ -2,7 +2,6 @@ from django.db.models import ForeignKey, Sum, Q from django.db.models.signals import post_delete from django.dispatch import receiver -from django.urls import reverse from Squest.utils.squest_model import SquestModel diff --git a/profiles/models/role.py b/profiles/models/role.py index 97be5d3bb..81b9cd988 100644 --- a/profiles/models/role.py +++ b/profiles/models/role.py @@ -1,7 +1,7 @@ -from profiles.models.squest_permission import Permission from django.db.models import CharField, ManyToManyField from Squest.utils.squest_model import SquestModel +from profiles.models.squest_permission import Permission class AbstractRole(SquestModel): diff --git a/profiles/models/team.py b/profiles/models/team.py index 4d3c3723a..104f1bc92 100644 --- a/profiles/models/team.py +++ b/profiles/models/team.py @@ -1,5 +1,6 @@ from django.core.exceptions import ValidationError from django.db.models import ForeignKey, PROTECT, Q + from profiles.models import Organization from profiles.models.scope import Scope diff --git a/profiles/tables/permission_table.py b/profiles/tables/permission_table.py index 0400d45a6..b259735f4 100644 --- a/profiles/tables/permission_table.py +++ b/profiles/tables/permission_table.py @@ -1,6 +1,7 @@ -from profiles.models.squest_permission import Permission from django_tables2 import tables, TemplateColumn +from profiles.models.squest_permission import Permission + class PermissionTable(tables.Table): actions = TemplateColumn(template_name='generics/custom_columns/generic_actions.html', orderable=False) diff --git a/profiles/tables/quota_table.py b/profiles/tables/quota_table.py index 95e390f3f..bf5f6da56 100644 --- a/profiles/tables/quota_table.py +++ b/profiles/tables/quota_table.py @@ -1,5 +1,5 @@ from django.utils.html import format_html -from django_tables2 import LinkColumn, Table, TemplateColumn +from django_tables2 import LinkColumn, TemplateColumn from Squest.utils.squest_table import SquestTable from profiles.models import Quota diff --git a/profiles/views/globalpermission.py b/profiles/views/globalpermission.py index 3c84bf7b2..91177322b 100644 --- a/profiles/views/globalpermission.py +++ b/profiles/views/globalpermission.py @@ -1,5 +1,3 @@ -from django.urls import reverse - from Squest.utils.squest_views import * from profiles.forms import GlobalPermissionForm from profiles.models import GlobalPermission diff --git a/profiles/views/permission.py b/profiles/views/permission.py index ee9d182f2..54a5f3399 100644 --- a/profiles/views/permission.py +++ b/profiles/views/permission.py @@ -2,8 +2,8 @@ from profiles.filters import PermissionFilter from profiles.forms.model_permission_form import ModelPermissionForm from profiles.forms.permission_form import PermissionForm -from profiles.tables import PermissionTable from profiles.models import Permission +from profiles.tables import PermissionTable from service_catalog.models import ApprovalStep diff --git a/profiles/views/scope.py b/profiles/views/scope.py index 8fa862a1e..e6c6603ee 100644 --- a/profiles/views/scope.py +++ b/profiles/views/scope.py @@ -9,7 +9,7 @@ from Squest.utils.squest_views import SquestFormView, SquestDeleteView from profiles.forms.scope_form import ScopeCreateRBACForm -from profiles.models import RBAC, Organization, GlobalPermission, AbstractScope, Team +from profiles.models import RBAC, GlobalPermission, AbstractScope, Team def get_breadcrumbs_for_scope(scope): diff --git a/resource_tracker_v2/forms/transformer_form.py b/resource_tracker_v2/forms/transformer_form.py index f1bc59cd8..4d3cf62aa 100644 --- a/resource_tracker_v2/forms/transformer_form.py +++ b/resource_tracker_v2/forms/transformer_form.py @@ -1,5 +1,5 @@ from django import forms -from django.forms import FloatField, ModelChoiceField +from django.forms import ModelChoiceField from Squest.utils.squest_model_form import SquestModelForm from resource_tracker_v2.models import AttributeDefinition, Transformer diff --git a/resource_tracker_v2/management/commands/import_resource_tracker_v1.py b/resource_tracker_v2/management/commands/import_resource_tracker_v1.py index ea162b1ff..3099db346 100644 --- a/resource_tracker_v2/management/commands/import_resource_tracker_v1.py +++ b/resource_tracker_v2/management/commands/import_resource_tracker_v1.py @@ -2,10 +2,10 @@ import os.path import yaml +from django.core.management import BaseCommand from Squest import settings from resource_tracker_v2.models import ResourceGroup, AttributeDefinition, Transformer, Resource -from django.core.management import BaseCommand logger = logging.getLogger(__name__) diff --git a/resource_tracker_v2/tables/resource_table.py b/resource_tracker_v2/tables/resource_table.py index 92a94d777..2234f8836 100644 --- a/resource_tracker_v2/tables/resource_table.py +++ b/resource_tracker_v2/tables/resource_table.py @@ -1,6 +1,4 @@ -from django_tables2 import CheckBoxColumn, TemplateColumn, Column, LinkColumn -from django_tables2.columns import BoundColumns -from django_tables2.utils import A +from django_tables2 import CheckBoxColumn, TemplateColumn, LinkColumn from Squest.utils.squest_table import SquestTable from resource_tracker_v2.models import Resource diff --git a/resource_tracker_v2/views/attribute_definition_views.py b/resource_tracker_v2/views/attribute_definition_views.py index 4f0cf06cd..b38698486 100644 --- a/resource_tracker_v2/views/attribute_definition_views.py +++ b/resource_tracker_v2/views/attribute_definition_views.py @@ -1,5 +1,4 @@ from Squest.utils.squest_views import * -from profiles.models import Quota from profiles.tables.quota_table import QuotaTable from resource_tracker_v2.filters.attribute_definition_filter import AttributeDefinitionFilter from resource_tracker_v2.forms.attribute_definition_form import AttributeDefinitionForm diff --git a/resource_tracker_v2/views/resource_group_views.py b/resource_tracker_v2/views/resource_group_views.py index c98043516..e88c33773 100644 --- a/resource_tracker_v2/views/resource_group_views.py +++ b/resource_tracker_v2/views/resource_group_views.py @@ -2,7 +2,6 @@ from resource_tracker_v2.filters.resource_group_filter import ResourceGroupFilter from resource_tracker_v2.forms.resource_group_form import ResourceGroupForm from resource_tracker_v2.models import ResourceGroup, AttributeDefinition, Transformer -from resource_tracker_v2.tables.attribute_defintion_table import AttributeDefinitionTable from resource_tracker_v2.tables.resource_group_table import ResourceGroupTable from resource_tracker_v2.tables.resource_table import ResourceTable from resource_tracker_v2.tables.transformer_table import TransformerTable diff --git a/service_catalog/api/serializers/approval_step_serializer.py b/service_catalog/api/serializers/approval_step_serializer.py index 5035829f5..14015d1ba 100644 --- a/service_catalog/api/serializers/approval_step_serializer.py +++ b/service_catalog/api/serializers/approval_step_serializer.py @@ -1,5 +1,3 @@ -from copy import deepcopy - from rest_framework.exceptions import ValidationError from rest_framework.relations import PrimaryKeyRelatedField from rest_framework.serializers import ModelSerializer diff --git a/service_catalog/api/serializers/approval_step_state_serializer.py b/service_catalog/api/serializers/approval_step_state_serializer.py index 590c6ed4d..e58e45629 100644 --- a/service_catalog/api/serializers/approval_step_state_serializer.py +++ b/service_catalog/api/serializers/approval_step_state_serializer.py @@ -1,4 +1,4 @@ -from rest_framework.serializers import ModelSerializer, Field +from rest_framework.serializers import ModelSerializer from service_catalog.models import ApprovalStepState diff --git a/service_catalog/api/views/approval_step_api_views.py b/service_catalog/api/views/approval_step_api_views.py index b68626cae..960097dcd 100644 --- a/service_catalog/api/views/approval_step_api_views.py +++ b/service_catalog/api/views/approval_step_api_views.py @@ -1,9 +1,7 @@ -from rest_framework.generics import get_object_or_404 - from Squest.utils.squest_api_views import SquestListCreateAPIView, SquestRetrieveUpdateDestroyAPIView from service_catalog.api.serializers.approval_step_serializer import ApprovalStepSerializer from service_catalog.filters.approval_step_filter import ApprovalStepFilter -from service_catalog.models import ApprovalStep, ApprovalWorkflow +from service_catalog.models import ApprovalStep class ApprovalStepListCreate(SquestListCreateAPIView): diff --git a/service_catalog/api/views/operation_api_views.py b/service_catalog/api/views/operation_api_views.py index 531198a16..dd62d55de 100644 --- a/service_catalog/api/views/operation_api_views.py +++ b/service_catalog/api/views/operation_api_views.py @@ -7,7 +7,6 @@ from service_catalog.models.instance import Instance from service_catalog.models.operation_type import OperationType from service_catalog.models.operations import Operation -from service_catalog.models.services import Service class OperationListCreate(SquestListCreateAPIView): diff --git a/service_catalog/api/views/operation_survey_api_views.py b/service_catalog/api/views/operation_survey_api_views.py index e51a85e37..cd8166265 100644 --- a/service_catalog/api/views/operation_survey_api_views.py +++ b/service_catalog/api/views/operation_survey_api_views.py @@ -1,10 +1,10 @@ from drf_yasg.utils import swagger_auto_schema from rest_framework import status -from rest_framework.exceptions import NotFound, PermissionDenied +from rest_framework.exceptions import NotFound from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response -from Squest.utils.squest_api_views import SquestObjectPermissions, SquestGenericAPIView, SquestRetrieveUpdateAPIView +from Squest.utils.squest_api_views import SquestObjectPermissions, SquestRetrieveUpdateAPIView from service_catalog.api.serializers.tower_survey_field_serializer import TowerSurveyFieldSerializer from service_catalog.models import Operation from service_catalog.models.tower_survey_field import TowerSurveyField diff --git a/service_catalog/api/views/request_state_machine_api_view.py b/service_catalog/api/views/request_state_machine_api_view.py index fa387b4c4..499dce680 100644 --- a/service_catalog/api/views/request_state_machine_api_view.py +++ b/service_catalog/api/views/request_state_machine_api_view.py @@ -1,4 +1,5 @@ from copy import deepcopy + from django_fsm import can_proceed from drf_yasg.utils import swagger_auto_schema from rest_framework import status diff --git a/service_catalog/filters/instance_filter.py b/service_catalog/filters/instance_filter.py index 581ec6456..1ea4fcad4 100644 --- a/service_catalog/filters/instance_filter.py +++ b/service_catalog/filters/instance_filter.py @@ -1,12 +1,12 @@ from django.contrib.auth.models import User from django.core.exceptions import ValidationError from django.db.models import Q -from django.forms import HiddenInput, CheckboxInput +from django.forms import CheckboxInput from django.utils.translation import gettext_lazy as _ from django_filters import MultipleChoiceFilter, BooleanFilter, BaseInFilter, CharFilter from Squest.utils.squest_filter import SquestFilter -from profiles.models import Scope, AbstractScope, GlobalPermission +from profiles.models import Scope, AbstractScope from service_catalog.models import Instance, Service from service_catalog.models.instance import InstanceState diff --git a/service_catalog/forms/approval_step_form.py b/service_catalog/forms/approval_step_form.py index d4a3c6415..1963010a3 100644 --- a/service_catalog/forms/approval_step_form.py +++ b/service_catalog/forms/approval_step_form.py @@ -1,9 +1,9 @@ -from profiles.models.squest_permission import Permission from django.core.exceptions import ValidationError from django.forms import ModelMultipleChoiceField, HiddenInput from django.urls import reverse from Squest.utils.squest_model_form import SquestModelForm +from profiles.models.squest_permission import Permission from service_catalog.models import ApprovalStep, TowerSurveyField EXCLUDED_PERMISSION = ["add_approvalstep", "change_approvalstep", "delete_approvalstep", "list_approvalstep", diff --git a/service_catalog/forms/form_generator.py b/service_catalog/forms/form_generator.py index e013f7367..3cc62734f 100644 --- a/service_catalog/forms/form_generator.py +++ b/service_catalog/forms/form_generator.py @@ -1,4 +1,3 @@ -import copy import logging from service_catalog.models import ApprovalState diff --git a/service_catalog/forms/tower_server_forms.py b/service_catalog/forms/tower_server_forms.py index 9f81afa39..5d532f66d 100644 --- a/service_catalog/forms/tower_server_forms.py +++ b/service_catalog/forms/tower_server_forms.py @@ -1,4 +1,5 @@ import re + import requests import towerlib from django import forms diff --git a/service_catalog/mail_utils.py b/service_catalog/mail_utils.py index 4dcd667ac..5759367a6 100644 --- a/service_catalog/mail_utils.py +++ b/service_catalog/mail_utils.py @@ -1,6 +1,5 @@ import base64 import logging - from os import linesep from django.conf import settings diff --git a/service_catalog/models/approval_step.py b/service_catalog/models/approval_step.py index 0bed1970d..297f039e9 100644 --- a/service_catalog/models/approval_step.py +++ b/service_catalog/models/approval_step.py @@ -1,11 +1,9 @@ -from django.urls import reverse - -from profiles.models.squest_permission import Permission -from django.db.models import ForeignKey, CharField, SET_NULL, CASCADE, IntegerField, ManyToManyField, PROTECT, Q, \ - TextField +from django.db.models import ForeignKey, CharField, SET_NULL, CASCADE, IntegerField, ManyToManyField, PROTECT, TextField from django.db.models.signals import post_save +from django.urls import reverse from Squest.utils.squest_model import SquestModel +from profiles.models.squest_permission import Permission class ApprovalStep(SquestModel): diff --git a/service_catalog/models/hooks.py b/service_catalog/models/hooks.py index 822bb8431..c785df65b 100644 --- a/service_catalog/models/hooks.py +++ b/service_catalog/models/hooks.py @@ -1,7 +1,7 @@ import logging from django.core.exceptions import ValidationError -from django.db.models import ForeignKey, CASCADE, CharField, JSONField, SET_NULL, IntegerField, ManyToManyField +from django.db.models import ForeignKey, CASCADE, CharField, JSONField, IntegerField, ManyToManyField from django.urls import reverse_lazy from django.utils.translation import gettext_lazy as _ @@ -60,7 +60,6 @@ def trigger_hook(cls, sender, instance, name, source, target, *args, **kwargs): :return: """ from service_catalog.api.serializers import InstanceReadSerializer, AdminRequestSerializer - from service_catalog.models import Instance, Request logger.debug(f"[HookManager] trigger_hook executed with " f"sender model '{sender.__name__}', " f"instance ID'{instance.id}', " diff --git a/service_catalog/models/instance.py b/service_catalog/models/instance.py index fc864850f..8bf54cad5 100644 --- a/service_catalog/models/instance.py +++ b/service_catalog/models/instance.py @@ -2,7 +2,7 @@ from django.contrib.auth.models import User from django.core.exceptions import ValidationError -from django.db.models import CharField, JSONField, ForeignKey, DateTimeField, ManyToManyField, PROTECT, Q, \ +from django.db.models import CharField, JSONField, ForeignKey, DateTimeField, PROTECT, Q, \ CASCADE from django.db.models.signals import post_save, pre_delete, pre_save from django.dispatch import receiver @@ -12,9 +12,9 @@ from Squest.utils.ansible_when import AnsibleWhen from Squest.utils.squest_model import SquestModel from profiles.models.scope import Scope +from service_catalog.models.hooks import HookManager from service_catalog.models.instance_state import InstanceState from service_catalog.models.services import Service -from service_catalog.models.hooks import HookManager logger = logging.getLogger(__name__) diff --git a/service_catalog/models/operations.py b/service_catalog/models/operations.py index 4d9025f00..c76719ffb 100644 --- a/service_catalog/models/operations.py +++ b/service_catalog/models/operations.py @@ -1,5 +1,5 @@ from django.core.exceptions import ValidationError -from django.db.models import CharField, ForeignKey, BooleanField, IntegerField, CASCADE, SET_NULL, JSONField, PROTECT +from django.db.models import CharField, ForeignKey, BooleanField, IntegerField, CASCADE, SET_NULL, JSONField from django.db.models.signals import post_save, pre_save, post_delete from django.dispatch import receiver from django.urls import reverse diff --git a/service_catalog/models/request.py b/service_catalog/models/request.py index 8b9efca2b..e16d37a93 100644 --- a/service_catalog/models/request.py +++ b/service_catalog/models/request.py @@ -18,10 +18,10 @@ from Squest.utils.ansible_when import AnsibleWhen from Squest.utils.squest_model import SquestModel from service_catalog.models.exceptions import ExceptionServiceCatalog +from service_catalog.models.hooks import HookManager from service_catalog.models.instance import Instance, InstanceState from service_catalog.models.operations import Operation, OperationType from service_catalog.models.request_state import RequestState -from service_catalog.models.hooks import HookManager logger = logging.getLogger(__name__) @@ -321,7 +321,6 @@ def _get_approval_workflow(self): return None def setup_approval_workflow(self): - from service_catalog.models import ApprovalWorkflow # search for a workflow on this operation workflow = self._get_approval_workflow() if not workflow: diff --git a/service_catalog/models/support.py b/service_catalog/models/support.py index 3edcfc017..0166f934c 100644 --- a/service_catalog/models/support.py +++ b/service_catalog/models/support.py @@ -1,10 +1,9 @@ from datetime import datetime from django.contrib.auth.models import User -from django.db.models import TextChoices, CharField, ForeignKey, DateTimeField, CASCADE, SET_NULL, Q, IntegerChoices +from django.db.models import CharField, ForeignKey, DateTimeField, CASCADE, SET_NULL, Q, IntegerChoices from django.urls import reverse -from django.utils.translation import gettext_lazy as _ -from django_fsm import FSMField, transition, FSMIntegerField +from django_fsm import transition, FSMIntegerField from Squest.utils.squest_model import SquestModel from service_catalog.mail_utils import send_mail_support_is_closed diff --git a/service_catalog/models/tower_survey_field.py b/service_catalog/models/tower_survey_field.py index 9da631928..c5eeaa85a 100644 --- a/service_catalog/models/tower_survey_field.py +++ b/service_catalog/models/tower_survey_field.py @@ -1,28 +1,27 @@ import logging import sys +from django.db.models import CharField, BooleanField, ForeignKey, CASCADE, SET_NULL, JSONField +from django.db.models.signals import pre_save +from django.dispatch import receiver from django.forms import CharField as FormsCharField -from django.forms import TextInput as FormsTextInput -from django.forms import Textarea as FormsTextarea -from django.forms import PasswordInput as FormsPasswordInput from django.forms import ChoiceField as FormsChoiceField -from django.forms import Select as FormsSelect -from django.forms import MultipleChoiceField as FormsMultipleChoiceField -from django.forms import SelectMultiple as FormsSelectMultiple +from django.forms import FloatField as FormsFloatField from django.forms import IntegerField as FormsIntegerField +from django.forms import MultipleChoiceField as FormsMultipleChoiceField from django.forms import NumberInput as FormsNumberInput -from django.forms import FloatField as FormsFloatField -from rest_framework.serializers import ChoiceField as DjangoRestChoiceField -from rest_framework.serializers import CharField as DjangoRestCharField -from rest_framework.serializers import MultipleChoiceField as DjangoRestMultipleChoiceField -from rest_framework.serializers import IntegerField as DjangoRestIntegerField -from rest_framework.serializers import FloatField as DjangoRestFloatField +from django.forms import PasswordInput as FormsPasswordInput +from django.forms import Select as FormsSelect +from django.forms import SelectMultiple as FormsSelectMultiple +from django.forms import TextInput as FormsTextInput +from django.forms import Textarea as FormsTextarea from jinja2 import Template from jinja2.exceptions import UndefinedError - -from django.db.models import CharField, BooleanField, ForeignKey, CASCADE, SET_NULL, JSONField -from django.db.models.signals import pre_save -from django.dispatch import receiver +from rest_framework.serializers import CharField as DjangoRestCharField +from rest_framework.serializers import ChoiceField as DjangoRestChoiceField +from rest_framework.serializers import FloatField as DjangoRestFloatField +from rest_framework.serializers import IntegerField as DjangoRestIntegerField +from rest_framework.serializers import MultipleChoiceField as DjangoRestMultipleChoiceField from Squest.utils.plugin_controller import PluginController from Squest.utils.squest_model import SquestModel diff --git a/service_catalog/tables/instance_tables.py b/service_catalog/tables/instance_tables.py index 3fdbd905e..bc7c4172b 100644 --- a/service_catalog/tables/instance_tables.py +++ b/service_catalog/tables/instance_tables.py @@ -1,7 +1,6 @@ from django.utils.html import format_html from django_tables2 import TemplateColumn, LinkColumn, CheckBoxColumn, Column -from django_tables2.utils import A from Squest.utils.squest_table import SquestTable from service_catalog.models import Instance diff --git a/service_catalog/tables/tower_server_tables.py b/service_catalog/tables/tower_server_tables.py index d26dc9ed4..f41bd0a50 100644 --- a/service_catalog/tables/tower_server_tables.py +++ b/service_catalog/tables/tower_server_tables.py @@ -1,5 +1,4 @@ from django_tables2 import TemplateColumn, LinkColumn -from django_tables2.utils import A from Squest.utils.squest_table import SquestTable from service_catalog.models import TowerServer diff --git a/service_catalog/views/filters.py b/service_catalog/views/filters.py index c8739b285..bd7d8a918 100644 --- a/service_catalog/views/filters.py +++ b/service_catalog/views/filters.py @@ -11,7 +11,7 @@ from service_catalog.models import BootstrapType, RequestState from service_catalog.models import Request -from service_catalog.models.instance import InstanceState, Instance +from service_catalog.models.instance import Instance from service_catalog.models.operations import OperationType from service_catalog.models.support import SupportState from .color import map_dict_request_state, map_dict_instance_state, map_dict_step_state diff --git a/service_catalog/views/job_template.py b/service_catalog/views/job_template.py index 6034b0f3b..68f201712 100644 --- a/service_catalog/views/job_template.py +++ b/service_catalog/views/job_template.py @@ -1,10 +1,9 @@ -from django.contrib.auth.decorators import permission_required, login_required +from django.contrib.auth.decorators import login_required from django.shortcuts import render, get_object_or_404 -from django.urls import reverse from Squest.utils.squest_views import * from service_catalog.filters.job_template_filter import JobTemplateFilter -from service_catalog.models import TowerServer, JobTemplate, OperationType +from service_catalog.models import TowerServer, JobTemplate from service_catalog.tables.job_template_tables import JobTemplateTable