diff --git a/personal/serializers.py b/personal/serializers.py index 285617d..03c2d61 100644 --- a/personal/serializers.py +++ b/personal/serializers.py @@ -14,9 +14,15 @@ class Meta: @ts_interface(context='personal') class DistrictSerializer(serializers.ModelSerializer): + id = serializers.SerializerMethodField('get_id') + class Meta: model = District - fields = '__all__' + fields = ['id', 'code', 'name', 'abbreviation', 'county'] + read_only_fields = ['id'] + + def get_id(self, obj): + return obj.code @ts_interface(context='personal')