Skip to content

Commit b5a960b

Browse files
committed
serialize the location id as id (rather than the object id) in abstractedlocationserializer, exclude hash field in urlserializer
1 parent 16a0680 commit b5a960b

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

dojo/location/api/serializers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
from rest_framework.relations import PrimaryKeyRelatedField
34
from rest_framework.serializers import CharField
45

56
from dojo.api_helpers.serializers import BaseModelSerializer
@@ -13,6 +14,7 @@
1314

1415

1516
class AbstractedLocationSerializer(BaseModelSerializer):
17+
id = PrimaryKeyRelatedField(source="location.id", read_only=True)
1618
string = CharField(source="location.location_value", read_only=True)
1719
type = CharField(source="location.location_type", read_only=True)
1820
tags = TagListSerializerField(source="location.tags", required=False)

dojo/url/api/serializer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ class Meta:
1111
"""Meta class for URLSerializer."""
1212

1313
model = URL
14-
fields = "__all__"
14+
exclude = ("location", "hash")

0 commit comments

Comments
 (0)