##// END OF EJS Templates
Added last update time to the initial thread result in api
neko259 -
r525:1a16db94 default
parent child Browse files
Show More
@@ -169,12 +169,18 b' def api_get_thread_posts(request, openin'
169 thread = opening_post.thread_new
169 thread = opening_post.thread_new
170 posts = thread.get_replies()
170 posts = thread.get_replies()
171
171
172 json_data = {
173 'posts': [],
174 'last_update': None,
175 }
172 json_post_list = []
176 json_post_list = []
173
177
174 for post in posts:
178 for post in posts:
175 json_post_list.append(_get_post_data(post.id))
179 json_post_list.append(_get_post_data(post.id))
180 json_data['last_update'] = _datetime_to_epoch(thread.last_edit_time)
181 json_data['posts'] = json_post_list
176
182
177 return HttpResponse(content=json.dumps(json_post_list))
183 return HttpResponse(content=json.dumps(json_data))
178
184
179
185
180 # TODO Add pub time and replies
186 # TODO Add pub time and replies
@@ -28,6 +28,11 b' associated with it.'
28
28
29 Get all ``N``th thread post. ``N`` is an opening post ID for the thread.
29 Get all ``N``th thread post. ``N`` is an opening post ID for the thread.
30
30
31 Output format:
32
33 * ``posts``: list of posts
34 * ``last_update``: last update timestamp
35
31 ## Thread diff ##
36 ## Thread diff ##
32
37
33 /api/diff_thread/N/M/?type=O
38 /api/diff_thread/N/M/?type=O
@@ -44,7 +49,7 b' format. 2 formats are available: ``html`'
44
49
45 In case of incorrect request you can get http error 404.
50 In case of incorrect request you can get http error 404.
46
51
47 Response JSON contains:
52 Response JSON for a post or thread contains:
48
53
49 * ``id``
54 * ``id``
50 * ``title``
55 * ``title``
General Comments 0
You need to be logged in to leave comments. Login now