Skip to content

Commit

Permalink
feat(api): expose last_updated for a unit
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Jun 12, 2024
1 parent 3b15225 commit 95fda7f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2136,6 +2136,7 @@ and XLIFF.
:>json string source_unit: Source unit link; see :http:get:`/api/units/(int:id)/`
:>json boolean pending: whether the unit is pending for write
:>json timestamp timestamp: string age
:>json timestamp last_updated: last string update

.. http:patch:: /api/units/(int:id)/
Expand Down
1 change: 1 addition & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Not yet released.
* Improved compatibility with password managers.
* Improved tracking of uploaded changes.
* Grafully handle temporary machine translation errors in automatic suggestions.
* :http:get:`/api/units/(int:id)/` now includes `last_updated` timestamp.

**Bug fixes**

Expand Down
2 changes: 2 additions & 0 deletions weblate/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,7 @@ class UnitSerializer(serializers.ModelSerializer[Unit]):
source = PluralField()
target = PluralField()
timestamp = serializers.DateTimeField(read_only=True)
last_updated = serializers.DateTimeField(read_only=True)
pending = serializers.BooleanField(read_only=True)
labels = UnitLabelsSerializer(many=True)

Expand Down Expand Up @@ -1094,6 +1095,7 @@ class Meta:
"extra_flags",
"pending",
"timestamp",
"last_updated",
)
extra_kwargs = {"url": {"view_name": "api:unit-detail"}}

Expand Down

0 comments on commit 95fda7f

Please sign in to comment.