From b5a960b954892884b3119a9d92b431adf4cc677c Mon Sep 17 00:00:00 2001 From: dogboat Date: Mon, 9 Feb 2026 09:56:40 -0500 Subject: [PATCH] serialize the location id as id (rather than the object id) in abstractedlocationserializer, exclude hash field in urlserializer --- dojo/location/api/serializers.py | 2 ++ dojo/url/api/serializer.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dojo/location/api/serializers.py b/dojo/location/api/serializers.py index 5051f5454a1..2695736390e 100644 --- a/dojo/location/api/serializers.py +++ b/dojo/location/api/serializers.py @@ -1,5 +1,6 @@ from __future__ import annotations +from rest_framework.relations import PrimaryKeyRelatedField from rest_framework.serializers import CharField from dojo.api_helpers.serializers import BaseModelSerializer @@ -13,6 +14,7 @@ class AbstractedLocationSerializer(BaseModelSerializer): + id = PrimaryKeyRelatedField(source="location.id", read_only=True) string = CharField(source="location.location_value", read_only=True) type = CharField(source="location.location_type", read_only=True) tags = TagListSerializerField(source="location.tags", required=False) diff --git a/dojo/url/api/serializer.py b/dojo/url/api/serializer.py index f35a9abf726..516193cba4c 100644 --- a/dojo/url/api/serializer.py +++ b/dojo/url/api/serializer.py @@ -11,4 +11,4 @@ class Meta: """Meta class for URLSerializer.""" model = URL - fields = "__all__" + exclude = ("location", "hash")