Skip to content

Commit

Permalink
feat(config_management): Add field child group count to table fields …
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-nfc committed Nov 15, 2024
1 parent 323d463 commit 317966b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/config_management/models/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ def validate_config_keys_not_reserved(self):
"left": [
'organization',
'name',
'parent',
'is_global'
],
"right": [
Expand Down Expand Up @@ -196,9 +195,8 @@ def validate_config_keys_not_reserved(self):

table_fields: list = [
'name',
'parent',
'count_children',
'organization'
'child_count',
'organization',
]


Expand Down
4 changes: 4 additions & 0 deletions app/config_management/serializers/config_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ def get_url(self, item) -> dict:
rendered_config = serializers.JSONField( source = 'render_config', read_only=True )


child_count = serializers.CharField( source = 'count_children', read_only = True )


class Meta:

model = ConfigGroups
Expand All @@ -127,6 +130,7 @@ class Meta:
'display_name',
'organization',
'parent',
'child_count',
'name',
'model_notes',
'config',
Expand Down
4 changes: 4 additions & 0 deletions app/config_management/viewsets/config_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ def get_queryset(self):

self.queryset = super().get_queryset().filter(parent = self.kwargs['parent_group'])

elif 'pk' in self.kwargs:

self.queryset = super().get_queryset().filter( pk = self.kwargs['pk'] )

else:

self.queryset = super().get_queryset().filter( parent = None )
Expand Down

0 comments on commit 317966b

Please sign in to comment.