feat(config_management): Add field child group count to table fields for groups
ref: #248 #385 #388 nofusscomputing/centurion_erp_ui#23
This commit is contained in:
@ -117,7 +117,6 @@ class ConfigGroups(GroupsCommonFields, SaveHistory):
|
||||
"left": [
|
||||
'organization',
|
||||
'name',
|
||||
'parent',
|
||||
'is_global'
|
||||
],
|
||||
"right": [
|
||||
@ -196,9 +195,8 @@ class ConfigGroups(GroupsCommonFields, SaveHistory):
|
||||
|
||||
table_fields: list = [
|
||||
'name',
|
||||
'parent',
|
||||
'count_children',
|
||||
'organization'
|
||||
'child_count',
|
||||
'organization',
|
||||
]
|
||||
|
||||
|
||||
|
@ -118,6 +118,9 @@ class ConfigGroupModelSerializer(
|
||||
rendered_config = serializers.JSONField( source = 'render_config', read_only=True )
|
||||
|
||||
|
||||
child_count = serializers.CharField( source = 'count_children', read_only = True )
|
||||
|
||||
|
||||
class Meta:
|
||||
|
||||
model = ConfigGroups
|
||||
@ -127,6 +130,7 @@ class ConfigGroupModelSerializer(
|
||||
'display_name',
|
||||
'organization',
|
||||
'parent',
|
||||
'child_count',
|
||||
'name',
|
||||
'model_notes',
|
||||
'config',
|
||||
|
@ -83,6 +83,10 @@ class ViewSet( ModelViewSet ):
|
||||
|
||||
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 )
|
||||
|
Reference in New Issue
Block a user