Coverage for apis_core/apis_entities/serializers.py: 86%

7 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-22 07:51 +0000

1from rest_framework import serializers 

2 

3from apis_core.generic.serializers import GenericHyperlinkedIdentityField 

4 

5 

6class MinimalEntitySerializer(serializers.Serializer): 

7 uri = GenericHyperlinkedIdentityField( 

8 view_name="apis_core:generic:genericmodelapi-detail" 

9 ) 

10 name = serializers.SerializerMethodField(method_name="get_name") 

11 

12 def get_name(self, object) -> str: 

13 return str(object)