Skip to content

Commit

Permalink
Add comment in changeset list/retrieve API's doc and templates/change…
Browse files Browse the repository at this point in the history
…set_detail.html
  • Loading branch information
simozhan committed Sep 7, 2015
1 parent dc11643 commit c87cc68
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
3 changes: 3 additions & 0 deletions pdc/apps/changeset/templates/changeset_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ <h1 class="page-header">{{ changeset }}</h1>
<dd>{{ changeset.author }}</dd>
<dt>{% trans "Date" %}</dt>
<dd>{{ changeset.committed_on|date:"Y-m-d H:i:s" }}</dd>
<dt>{% trans "Comment" %}</dt>
<dd>{{ changeset.comment }}</dd>

</dl>

<h2 class="sub-header">{% trans "Changes" %}</h2>
Expand Down
28 changes: 22 additions & 6 deletions pdc/apps/changeset/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,15 @@ def list(self, request, *args, **kwargs):
"committed_on": "2015-02-03T05:51:17.262Z",
"changes": [
{
"id": 1
"resource": "person",
"resource_id": 2,
"resource_id": "2",
"old_value": "old",
"new_value": "new"
}
]
],
"comment": "xxx"
}
},
...
]
Expand All @@ -106,16 +107,18 @@ def list(self, request, *args, **kwargs):
"previous": null,
"results": [
{
"id": 1
"author": "xxx",
"committed_on": "2015-02-03T05:51:17.262Z",
"changes": [
{
"resource": "person",
"resource_id": 2,
"resource_id": "2",
"old_value": "old",
"new_value": "new"
}
]
],
"comment": "xxx"
}
]
}
Expand Down Expand Up @@ -144,7 +147,20 @@ def retrieve(self, request, *args, **kwargs):
curl -H "Content-Type: application/json" $URL:changeset-detail:1$
# output
{"author": "xxx", "committed_on": "2015-02-03T05:51:17.262Z", "changes": [{"resource": "person", "resource_id": 2, "old_value": "old", "new_value": "new"}]}
{
"id": 1,
"author": "xxx",
"committed_on": "2015-02-03T05:51:17.262Z",
"changes": [
{
"resource": "person",
"resource_id": "2",
"old_value": "old",
"new_value": "new"
}
],
"comment": "xxx"
}
"""
return super(ChangesetViewSet, self).retrieve(request, *args, **kwargs)

Expand Down

0 comments on commit c87cc68

Please sign in to comment.