Skip to content

Commit

Permalink
Add _string fields to PostalCodeResultSerializer
Browse files Browse the repository at this point in the history
  • Loading branch information
juuso-j committed Feb 13, 2024
1 parent e14cb65 commit e70abc7
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion profiles/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,26 @@ class Meta:


class PostalCodeResultSerializer(serializers.ModelSerializer):
result_topic_en = serializers.CharField(source="result.topic_en", read_only=True)
postal_code_string = serializers.CharField(
source="postal_code.postal_code", read_only=True
)
postal_code_type_string = serializers.CharField(
source="postal_code_type.type_name", read_only=True
)

class Meta:
model = PostalCodeResult
fields = "__all__"
fields = [
"id",
"postal_code",
"postal_code_string",
"postal_code_type",
"postal_code_type_string",
"result",
"result_topic_en",
"count",
]


class PostalCodeSerializer(serializers.ModelSerializer):
Expand Down

0 comments on commit e70abc7

Please sign in to comment.