diff --git a/apps/accounts/filters.py b/apps/accounts/filters.py index be2cf1dfd..dc28d78aa 100644 --- a/apps/accounts/filters.py +++ b/apps/accounts/filters.py @@ -13,7 +13,7 @@ class AccountFilterSet(BaseFilterSet): hostname = drf_filters.CharFilter(field_name='name', lookup_expr='exact') username = drf_filters.CharFilter(field_name="username", lookup_expr='exact') address = drf_filters.CharFilter(field_name="asset__address", lookup_expr='exact') - asset = drf_filters.CharFilter(field_name="asset_id", lookup_expr='exact') + asset_id = drf_filters.CharFilter(field_name="asset", lookup_expr='exact') assets = drf_filters.CharFilter(field_name='asset_id', lookup_expr='exact') nodes = drf_filters.CharFilter(method='filter_nodes') node_id = drf_filters.CharFilter(method='filter_nodes') @@ -45,7 +45,7 @@ class AccountFilterSet(BaseFilterSet): class Meta: model = Account - fields = ['id', 'asset_id', 'source_id', 'secret_type'] + fields = ['id', 'asset', 'source_id', 'secret_type'] class GatheredAccountFilterSet(BaseFilterSet): diff --git a/apps/orgs/signal_handlers/common.py b/apps/orgs/signal_handlers/common.py index 998ee216c..83edeb425 100644 --- a/apps/orgs/signal_handlers/common.py +++ b/apps/orgs/signal_handlers/common.py @@ -103,8 +103,12 @@ def on_user_created_set_default_org(sender, instance, created, **kwargs): return if instance.orgs.count() > 0: return - with tmp_to_org(Organization.default()): - Organization.default().add_member(instance) + default_org = Organization.default() + with tmp_to_org(default_org): + default_org.add_member(instance) + default_group = UserGroup.objects.filter(name='Default').first() + if default_group: + default_group.users.add(instance) def _remove_user_resource(model, users, org, user_field_name='users'):