Show More
@@ -28,7 +28,9 b" STATUS_ERROR = 'error'" | |||||
28 |
|
28 | |||
29 | @transaction.atomic |
|
29 | @transaction.atomic | |
30 | def api_get_threaddiff(request, thread_id, last_update_time): |
|
30 | def api_get_threaddiff(request, thread_id, last_update_time): | |
31 | """Get posts that were changed or added since time""" |
|
31 | """ | |
|
32 | Gets posts that were changed or added since time | |||
|
33 | """ | |||
32 |
|
34 | |||
33 | thread = get_object_or_404(Post, id=thread_id).thread_new |
|
35 | thread = get_object_or_404(Post, id=thread_id).thread_new | |
34 |
|
36 | |||
@@ -62,7 +64,7 b' def api_get_threaddiff(request, thread_i' | |||||
62 |
|
64 | |||
63 | def api_add_post(request, opening_post_id): |
|
65 | def api_add_post(request, opening_post_id): | |
64 | """ |
|
66 | """ | |
65 | Add a post and return the JSON response for it |
|
67 | Adds a post and return the JSON response for it | |
66 | """ |
|
68 | """ | |
67 |
|
69 | |||
68 | opening_post = get_object_or_404(Post, id=opening_post_id) |
|
70 | opening_post = get_object_or_404(Post, id=opening_post_id) | |
@@ -96,7 +98,7 b' def api_add_post(request, opening_post_i' | |||||
96 |
|
98 | |||
97 | def get_post(request, post_id): |
|
99 | def get_post(request, post_id): | |
98 | """ |
|
100 | """ | |
99 | Get the html of a post. Used for popups. Post can be truncated if used |
|
101 | Gets the html of a post. Used for popups. Post can be truncated if used | |
100 | in threads list with 'truncated' get parameter. |
|
102 | in threads list with 'truncated' get parameter. | |
101 | """ |
|
103 | """ | |
102 |
|
104 | |||
@@ -113,7 +115,7 b' def get_post(request, post_id):' | |||||
113 | # TODO Test this |
|
115 | # TODO Test this | |
114 | def api_get_threads(request, count): |
|
116 | def api_get_threads(request, count): | |
115 | """ |
|
117 | """ | |
116 | Get the JSON thread opening posts list. |
|
118 | Gets the JSON thread opening posts list. | |
117 | Parameters that can be used for filtering: |
|
119 | Parameters that can be used for filtering: | |
118 | tag, offset (from which thread to get results) |
|
120 | tag, offset (from which thread to get results) | |
119 | """ |
|
121 | """ | |
@@ -149,7 +151,7 b' def api_get_threads(request, count):' | |||||
149 | # TODO Test this |
|
151 | # TODO Test this | |
150 | def api_get_tags(request): |
|
152 | def api_get_tags(request): | |
151 | """ |
|
153 | """ | |
152 | Get all tags or user tags. |
|
154 | Gets all tags or user tags. | |
153 | """ |
|
155 | """ | |
154 |
|
156 | |||
155 | # TODO Get favorite tags for the given user ID |
|
157 | # TODO Get favorite tags for the given user ID | |
@@ -166,11 +168,11 b' def api_get_tags(request):' | |||||
166 | # TODO Test this |
|
168 | # TODO Test this | |
167 | def api_get_thread_posts(request, opening_post_id): |
|
169 | def api_get_thread_posts(request, opening_post_id): | |
168 | """ |
|
170 | """ | |
169 | Get the JSON array of thread posts |
|
171 | Gets the JSON array of thread posts | |
170 | """ |
|
172 | """ | |
171 |
|
173 | |||
172 | opening_post = get_object_or_404(Post, id=opening_post_id) |
|
174 | opening_post = get_object_or_404(Post, id=opening_post_id) | |
173 |
thread = opening_post.thread |
|
175 | thread = opening_post.get_thread() | |
174 | posts = thread.get_replies() |
|
176 | posts = thread.get_replies() | |
175 |
|
177 | |||
176 | json_data = { |
|
178 | json_data = { | |
@@ -189,7 +191,7 b' def api_get_thread_posts(request, openin' | |||||
189 |
|
191 | |||
190 | def api_get_post(request, post_id): |
|
192 | def api_get_post(request, post_id): | |
191 | """ |
|
193 | """ | |
192 | Get the JSON of a post. This can be |
|
194 | Gets the JSON of a post. This can be | |
193 | used as and API for external clients. |
|
195 | used as and API for external clients. | |
194 | """ |
|
196 | """ | |
195 |
|
197 |
General Comments 0
You need to be logged in to leave comments.
Login now