diff --git a/apps/assets/models/account.py b/apps/assets/models/account.py index 6f122cfe2..7b9e543a2 100644 --- a/apps/assets/models/account.py +++ b/apps/assets/models/account.py @@ -10,7 +10,7 @@ __all__ = ['Account', 'AccountTemplate'] class Account(BaseAccount): - asset = models.ForeignKey('assets.Asset', on_delete=models.CASCADE, verbose_name=_('Asset')) + asset = models.ForeignKey('assets.Asset', related_name='accounts', on_delete=models.CASCADE, verbose_name=_('Asset')) version = models.IntegerField(default=0, verbose_name=_('Version')) history = HistoricalRecords() diff --git a/apps/assets/serializers/asset/common.py b/apps/assets/serializers/asset/common.py index 61e32a7a8..f55a73c3d 100644 --- a/apps/assets/serializers/asset/common.py +++ b/apps/assets/serializers/asset/common.py @@ -8,7 +8,7 @@ from django.db.models import F from common.drf.serializers import JMSWritableNestedModelSerializer from common.drf.fields import LabeledChoiceField, ObjectRelatedField from ..account import AccountSerializer -from ...models import Asset, Node, Platform, Protocol, Label, Domain +from ...models import Asset, Node, Platform, Protocol, Label, Domain, Account from ...const import Category, AllTypes __all__ = [ @@ -88,11 +88,6 @@ class AssetSerializer(JMSWritableNestedModelSerializer): 'admin_user_display': {'label': _('Admin user display'), 'read_only': True}, } - def __init__(self, *args, **kwargs): - data = kwargs.get('data', {}) - self.accounts_data = data.pop('accounts', []) - super().__init__(*args, **kwargs) - @classmethod def setup_eager_loading(cls, queryset): """ Perform necessary eager loading of data. """ diff --git a/apps/assets/serializers/platform.py b/apps/assets/serializers/platform.py index 01f2e8956..600098b86 100644 --- a/apps/assets/serializers/platform.py +++ b/apps/assets/serializers/platform.py @@ -19,6 +19,7 @@ class ProtocolSettingSerializer(serializers.Serializer): ] # Common required = serializers.BooleanField(required=True, initial=False, label=_("Required")) + # RDP console = serializers.BooleanField(required=False) security = serializers.ChoiceField(choices=SECURITY_CHOICES, default='any', required=False)