mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-25 06:42:49 +00:00
perf: 修改细节
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
|
||||
from rest_framework import viewsets
|
||||
|
||||
from users.models import User
|
||||
from common.permissions import IsValidUser
|
||||
from common.exceptions import JMSException
|
||||
from users.models import User
|
||||
from orgs.utils import get_org_by_id
|
||||
from .. import serializers
|
||||
|
||||
@@ -20,7 +19,8 @@ class AssigneeViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
org_id = self.request.query_params.get('org_id')
|
||||
org = get_org_by_id(org_id)
|
||||
if not org:
|
||||
raise JMSException('The organization `{}` does not exist'.format(org_id))
|
||||
error = ('The organization `{}` does not exist'.format(org_id))
|
||||
raise JMSException(error)
|
||||
return org
|
||||
|
||||
def get_queryset(self):
|
||||
|
@@ -15,7 +15,7 @@ __all__ = ['CommentViewSet']
|
||||
|
||||
class CommentViewSet(mixins.CreateModelMixin, viewsets.ReadOnlyModelViewSet):
|
||||
serializer_class = serializers.CommentSerializer
|
||||
permission_classes = (IsSwagger| IsAssignee | IsApplicant,)
|
||||
permission_classes = (IsSwagger | IsAssignee | IsApplicant,)
|
||||
|
||||
@lazyproperty
|
||||
def ticket(self):
|
||||
|
@@ -5,12 +5,13 @@ from rest_framework import viewsets
|
||||
from rest_framework.decorators import action
|
||||
from rest_framework.exceptions import MethodNotAllowed
|
||||
|
||||
from common.const.http import POST, PUT
|
||||
from common.mixins.api import CommonApiMixin
|
||||
from common.permissions import IsValidUser, IsOrgAdmin
|
||||
from common.const.http import POST, PUT
|
||||
from tickets import serializers, const
|
||||
from tickets.permissions.ticket import IsAssignee, NotClosed
|
||||
|
||||
from tickets import serializers
|
||||
from tickets.models import Ticket
|
||||
from tickets.permissions.ticket import IsAssignee, NotClosed
|
||||
|
||||
|
||||
__all__ = ['TicketViewSet']
|
||||
@@ -67,7 +68,6 @@ class TicketViewSet(CommonApiMixin, viewsets.ModelViewSet):
|
||||
def get_dynamic_mapping_fields_mapping_rule(self):
|
||||
from tickets.serializers.ticket.meta import get_meta_field_mapping_rule_by_view
|
||||
meta_field_mapping_rule = get_meta_field_mapping_rule_by_view(self)
|
||||
fields_mapping_rule = {
|
||||
return {
|
||||
'meta': meta_field_mapping_rule,
|
||||
}
|
||||
return fields_mapping_rule
|
||||
|
Reference in New Issue
Block a user