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:
2024-11-15 14:15:52 +09:30
parent 5899bb17ca
commit e0168640cf
3 changed files with 10 additions and 4 deletions

View File

@ -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',
]

View File

@ -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',

View File

@ -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 )