diff --git a/src/aurora/api/serializers/record.py b/src/aurora/api/serializers/record.py index 5799fc47..73f4aacd 100644 --- a/src/aurora/api/serializers/record.py +++ b/src/aurora/api/serializers/record.py @@ -14,6 +14,10 @@ class RecordSerializer(serializers.ModelSerializer): registration_url = serializers.SerializerMethodField() registrar = serializers.CharField() + project = serializers.SerializerMethodField() + organization = serializers.SerializerMethodField() + project_slug = serializers.SerializerMethodField() + organization_slug = serializers.SerializerMethodField() class Meta: model = Record @@ -23,6 +27,18 @@ def get_registration_url(self, obj): req = self.context["request"] return req.build_absolute_uri(reverse("api:registration-detail", kwargs={"pk": obj.registration_id})) + def get_project(self, obj: Record): + return obj.registration.project.pk + + def get_organization(self, obj): + return obj.registration.project.organization.pk + + def get_project_slug(self, obj: Record): + return obj.registration.project.slug + + def get_organization_slug(self, obj): + return obj.registration.project.organization.slug + class DataTableRecordSerializer(serializers.ModelSerializer): def __init__(self, instance=None, data=empty, **kwargs):