From a373dff209e286240d364cdf09c2469e2a573258 Mon Sep 17 00:00:00 2001 From: git-hyagi <45576767+git-hyagi@users.noreply.github.com> Date: Wed, 7 Feb 2024 15:08:29 -0300 Subject: [PATCH] Serialize `pulp_last_updated` field closes: #5033 --- CHANGES/5033.feature | 1 + pulpcore/app/serializers/base.py | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 CHANGES/5033.feature diff --git a/CHANGES/5033.feature b/CHANGES/5033.feature new file mode 100644 index 0000000000..4f960e320f --- /dev/null +++ b/CHANGES/5033.feature @@ -0,0 +1 @@ +Added a serializer to output `pulp_last_updated` field on pulp resources. diff --git a/pulpcore/app/serializers/base.py b/pulpcore/app/serializers/base.py index 683eb8808e..3192769812 100644 --- a/pulpcore/app/serializers/base.py +++ b/pulpcore/app/serializers/base.py @@ -418,9 +418,17 @@ class ModelSerializer( exclude_arg_name = "exclude_fields" class Meta: - fields = ("pulp_href", "pulp_created") + fields = ("pulp_href", "pulp_created", "pulp_last_updated") pulp_created = serializers.DateTimeField(help_text=_("Timestamp of creation."), read_only=True) + pulp_last_updated = serializers.DateTimeField( + help_text=_( + "Timestamp of the last time this resource was updated. Note: for immutable " + "resources - like content, repository versions, and publication - pulp_created and " + "pulp_last_updated dates will be the same." + ), + read_only=True, + ) def _validate_relative_path(self, path): """