##// END OF EJS Templates
Style cleanup in api module
neko259 -
r504:dab23797 1.6-dev
parent child Browse files
Show More
@@ -30,7 +30,7 b' def api_get_threaddiff(request, thread_i'
30 'added': [],
30 'added': [],
31 'updated': [],
31 'updated': [],
32 'last_update': None,
32 'last_update': None,
33 }
33 }
34 added_posts = Post.objects.filter(thread_new=thread,
34 added_posts = Post.objects.filter(thread_new=thread,
35 pub_time__gt=filter_time) \
35 pub_time__gt=filter_time) \
36 .order_by('pub_time')
36 .order_by('pub_time')
@@ -129,15 +129,15 b' def api_get_threads(request, count):'
129
129
130 # TODO Add pub time, tags, replies and images count
130 # TODO Add pub time, tags, replies and images count
131 post_json = {
131 post_json = {
132 'id' : opening_post.id,
132 'id': opening_post.id,
133 'title' : opening_post.title,
133 'title': opening_post.title,
134 'text' : opening_post.text.rendered,
134 'text': opening_post.text.rendered,
135 }
135 }
136 if opening_post.image:
136 if opening_post.image:
137 post_json += {
137 post_json += {
138 'image' : opening_post.image.url,
138 'image': opening_post.image.url,
139 'image_preview' : opening_post.image.url_200x150,
139 'image_preview': opening_post.image.url_200x150,
140 }
140 }
141 opening_posts.append(post_json)
141 opening_posts.append(post_json)
142
142
143 return HttpResponse(content=json.dumps(opening_posts))
143 return HttpResponse(content=json.dumps(opening_posts))
@@ -175,15 +175,15 b' def api_get_thread_posts(request, openin'
175 for post in posts:
175 for post in posts:
176 # TODO Add pub time and replies
176 # TODO Add pub time and replies
177 post_json = {
177 post_json = {
178 'id' : post.id,
178 'id': post.id,
179 'title' : post.title,
179 'title': post.title,
180 'text' : post.text.rendered,
180 'text': post.text.rendered,
181 }
181 }
182 if post.image:
182 if post.image:
183 post_json += {
183 post_json += {
184 'image' : post.image.url,
184 'image': post.image.url,
185 'image_preview' : post.image.url_200x150,
185 'image_preview': post.image.url_200x150,
186 }
186 }
187 json_post_list.append(post_json)
187 json_post_list.append(post_json)
188
188
189 return HttpResponse(content=json.dumps(json_post_list))
189 return HttpResponse(content=json.dumps(json_post_list))
General Comments 0
You need to be logged in to leave comments. Login now