mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-08 18:59:47 +00:00
perf: 修改结构
This commit is contained in:
@@ -2,11 +2,8 @@ from .mixin import *
|
||||
from .platform import *
|
||||
from .asset import *
|
||||
from .label import *
|
||||
from .accounts import *
|
||||
from .account import *
|
||||
from .node import *
|
||||
from .domain import *
|
||||
from .gathered_user import *
|
||||
from .favorite_asset import *
|
||||
from .account_template import *
|
||||
from .account_backup import *
|
||||
from .account_history import *
|
||||
|
4
apps/assets/api/account/__init__.py
Normal file
4
apps/assets/api/account/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from .account import *
|
||||
from .backup import *
|
||||
from .history import *
|
||||
from .template import *
|
@@ -9,9 +9,9 @@ from common.drf.filters import BaseFilterSet, UUIDInFilter
|
||||
from common.mixins import RecordViewLogMixin
|
||||
from common.permissions import UserConfirmation
|
||||
from authentication.const import ConfirmType
|
||||
from ..tasks.account_connectivity import test_accounts_connectivity_manual
|
||||
from ..models import Account, Node
|
||||
from .. import serializers
|
||||
from assets.tasks.account_connectivity import test_accounts_connectivity_manual
|
||||
from assets.models import Account, Node
|
||||
from assets import serializers
|
||||
|
||||
__all__ = ['AccountFilterSet', 'AccountViewSet', 'AccountSecretsViewSet', 'AccountTaskCreateAPI']
|
||||
|
@@ -4,9 +4,9 @@ from rest_framework import status, viewsets
|
||||
from rest_framework.response import Response
|
||||
|
||||
from orgs.mixins.api import OrgBulkModelViewSet
|
||||
from .. import serializers
|
||||
from ..tasks import execute_account_backup_plan
|
||||
from ..models import (
|
||||
from assets import serializers
|
||||
from assets.tasks import execute_account_backup_plan
|
||||
from assets.models import (
|
||||
AccountBackupPlan, AccountBackupPlanExecution
|
||||
)
|
||||
|
@@ -1,9 +1,9 @@
|
||||
from assets.api.accounts import (
|
||||
from .account import (
|
||||
AccountFilterSet, AccountViewSet, AccountSecretsViewSet
|
||||
)
|
||||
from common.mixins import RecordViewLogMixin
|
||||
from .. import serializers
|
||||
from ..models import Account
|
||||
from assets import serializers
|
||||
from assets.models import Account
|
||||
|
||||
__all__ = ['AccountHistoryViewSet', 'AccountHistorySecretsViewSet']
|
||||
|
24
apps/assets/migrations/0113_auto_20220913_1311.py
Normal file
24
apps/assets/migrations/0113_auto_20220913_1311.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# Generated by Django 3.2.14 on 2022-09-13 05:11
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('assets', '0112_auto_20220909_1907'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='account',
|
||||
name='su_from',
|
||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='su_to', to='assets.account', verbose_name='Su from'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='historicalaccount',
|
||||
name='su_from',
|
||||
field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='assets.account', verbose_name='Su from'),
|
||||
),
|
||||
]
|
@@ -10,7 +10,14 @@ __all__ = ['Account', 'AccountTemplate']
|
||||
|
||||
|
||||
class Account(BaseAccount):
|
||||
asset = models.ForeignKey('assets.Asset', related_name='accounts', on_delete=models.CASCADE, verbose_name=_('Asset'))
|
||||
asset = models.ForeignKey(
|
||||
'assets.Asset', related_name='accounts',
|
||||
on_delete=models.CASCADE, verbose_name=_('Asset')
|
||||
)
|
||||
su_from = models.ForeignKey(
|
||||
'assets.Account', related_name='su_to', null=True,
|
||||
on_delete=models.SET_NULL, verbose_name=_("Su from")
|
||||
)
|
||||
version = models.IntegerField(default=0, verbose_name=_('Version'))
|
||||
history = HistoricalRecords()
|
||||
|
||||
|
Reference in New Issue
Block a user