diff --git a/personal/serializers.py b/personal/serializers.py index 8a1718f..7e893f9 100644 --- a/personal/serializers.py +++ b/personal/serializers.py @@ -22,15 +22,20 @@ class Meta: @ts_interface(context='personal') class SchoolSerializer(serializers.ModelSerializer): verbose_name = serializers.SerializerMethodField('get_verbose_name') + id = serializers.SerializerMethodField('get_id') class Meta: model = School - fields = ['code', 'name', 'abbreviation', 'street', + fields = ['id', 'code', 'name', 'abbreviation', 'street', 'city', 'zip_code', 'email', 'district', 'verbose_name'] + read_only_fields = ['id', 'verbose_name'] def get_verbose_name(self, obj): return str(obj) + def get_id(self, obj): + return obj.code + @ts_interface(context='personal') class SchoolShortSerializer(serializers.ModelSerializer):