Skip to content

Commit

Permalink
Serialize pulp_last_updated field
Browse files Browse the repository at this point in the history
closes: #5033
  • Loading branch information
git-hyagi authored and lubosmj committed Feb 26, 2024
1 parent cdd9019 commit a373dff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES/5033.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added a serializer to output `pulp_last_updated` field on pulp resources.
10 changes: 9 additions & 1 deletion pulpcore/app/serializers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down

0 comments on commit a373dff

Please sign in to comment.