mirror of https://github.com/jumpserver/jumpserver
perf: 修复用户平台内置的问题
parent
5d61d843f3
commit
6f765ebef5
|
@ -101,9 +101,10 @@ class AccountSerializer(AccountSerializerCreateMixin, BaseAccountSerializer):
|
||||||
|
|
||||||
class Meta(BaseAccountSerializer.Meta):
|
class Meta(BaseAccountSerializer.Meta):
|
||||||
model = Account
|
model = Account
|
||||||
fields = BaseAccountSerializer.Meta.fields \
|
fields = BaseAccountSerializer.Meta.fields + [
|
||||||
+ ['su_from', 'asset'] \
|
'su_from', 'asset', 'template',
|
||||||
+ ['template', 'push_now', 'source']
|
'push_now', 'source', 'connectivity'
|
||||||
|
]
|
||||||
extra_kwargs = {
|
extra_kwargs = {
|
||||||
**BaseAccountSerializer.Meta.extra_kwargs,
|
**BaseAccountSerializer.Meta.extra_kwargs,
|
||||||
'name': {'required': False, 'allow_null': True},
|
'name': {'required': False, 'allow_null': True},
|
||||||
|
|
|
@ -329,9 +329,8 @@ class AllTypes(ChoicesMixin):
|
||||||
internal_platforms.append(d['name'])
|
internal_platforms.append(d['name'])
|
||||||
|
|
||||||
user_platforms = platform_cls.objects.exclude(name__in=internal_platforms)
|
user_platforms = platform_cls.objects.exclude(name__in=internal_platforms)
|
||||||
user_platforms.update(internal=False)
|
|
||||||
|
|
||||||
for platform in user_platforms:
|
for platform in user_platforms:
|
||||||
print("\t- Update platform: {}".format(platform.name))
|
print("\t- Update platform: {}".format(platform.name))
|
||||||
platform_data = cls.get_type_default_platform(platform.category, platform.type)
|
platform_data = cls.get_type_default_platform(platform.category, platform.type)
|
||||||
cls.create_or_update_by_platform_data(platform.name, platform_data, platform_cls=platform_cls)
|
cls.create_or_update_by_platform_data(platform.name, platform_data, platform_cls=platform_cls)
|
||||||
|
user_platforms.update(internal=False)
|
||||||
|
|
Loading…
Reference in New Issue