*: add model_name to TypeCreate API to pass to forms

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-04-17 19:12:00 +02:00
parent 4add0bbe86
commit 67240fb9ad
10 changed files with 14 additions and 0 deletions

View File

@ -93,6 +93,7 @@ class PropertyMappingViewSet(
"description": subclass.__doc__, "description": subclass.__doc__,
# pyright: reportGeneralTypeIssues=false # pyright: reportGeneralTypeIssues=false
"component": subclass().component, "component": subclass().component,
"model_name": subclass._meta.model_name
} }
) )
return Response(TypeCreateSerializer(data, many=True).data) return Response(TypeCreateSerializer(data, many=True).data)

View File

@ -78,6 +78,7 @@ class ProviderViewSet(
"name": subclass._meta.verbose_name, "name": subclass._meta.verbose_name,
"description": subclass.__doc__, "description": subclass.__doc__,
"component": subclass().component, "component": subclass().component,
"model_name": subclass._meta.model_name
} }
) )
data.append( data.append(

View File

@ -81,6 +81,7 @@ class SourceViewSet(
"name": subclass._meta.verbose_name, "name": subclass._meta.verbose_name,
"description": subclass.__doc__, "description": subclass.__doc__,
"component": component, "component": component,
"model_name": subclass._meta.model_name
} }
) )
return Response(TypeCreateSerializer(data, many=True).data) return Response(TypeCreateSerializer(data, many=True).data)

View File

@ -48,6 +48,7 @@ class TypeCreateSerializer(PassiveSerializer):
name = CharField(required=True) name = CharField(required=True)
description = CharField(required=True) description = CharField(required=True)
component = CharField(required=True) component = CharField(required=True)
model_name = CharField(required=True)
class CacheSerializer(PassiveSerializer): class CacheSerializer(PassiveSerializer):

View File

@ -157,6 +157,7 @@ class EventViewSet(ReadOnlyModelViewSet):
"name": name, "name": name,
"description": "", "description": "",
"component": value, "component": value,
"model_name": ""
} }
) )
return Response(TypeCreateSerializer(data, many=True).data) return Response(TypeCreateSerializer(data, many=True).data)

View File

@ -80,6 +80,7 @@ class StageViewSet(
"name": subclass._meta.verbose_name, "name": subclass._meta.verbose_name,
"description": subclass.__doc__, "description": subclass.__doc__,
"component": subclass().component, "component": subclass().component,
"model_name": subclass._meta.model_name
} }
) )
data = sorted(data, key=lambda x: x["name"]) data = sorted(data, key=lambda x: x["name"])

View File

@ -82,6 +82,7 @@ class ServiceConnectionViewSet(
"name": subclass._meta.verbose_name, "name": subclass._meta.verbose_name,
"description": subclass.__doc__, "description": subclass.__doc__,
"component": subclass().component, "component": subclass().component,
"model_name": subclass._meta.model_name
} }
) )
return Response(TypeCreateSerializer(data, many=True).data) return Response(TypeCreateSerializer(data, many=True).data)

View File

@ -108,6 +108,7 @@ class PolicyViewSet(
"name": subclass._meta.verbose_name, "name": subclass._meta.verbose_name,
"description": subclass.__doc__, "description": subclass.__doc__,
"component": subclass().component, "component": subclass().component,
"model_name": subclass._meta.model_name
} }
) )
return Response(TypeCreateSerializer(data, many=True).data) return Response(TypeCreateSerializer(data, many=True).data)

View File

@ -63,6 +63,7 @@ class EmailStageViewSet(ModelViewSet):
"name": value, "name": value,
"description": label, "description": label,
"component": "", "component": "",
"model_name": "",
} }
) )
return Response(TypeCreateSerializer(choices, many=True).data) return Response(TypeCreateSerializer(choices, many=True).data)

View File

@ -14771,6 +14771,7 @@ definitions:
- name - name
- description - description
- component - component
- model_name
type: object type: object
properties: properties:
name: name:
@ -14785,6 +14786,10 @@ definitions:
title: Component title: Component
type: string type: string
minLength: 1 minLength: 1
model_name:
title: Model name
type: string
minLength: 1
EventTopPerUser: EventTopPerUser:
required: required:
- application - application