Skip to content

Commit 1b9e301

Browse files
author
Puja0708
committedAug 23, 2015
cleaning up
1 parent 154dd1f commit 1b9e301

File tree

3 files changed

+3
-23
lines changed

3 files changed

+3
-23
lines changed
 

‎comments.json

Whitespace-only changes.

‎django_comments/comments.json

Whitespace-only changes.

‎django_comments/django_comments/views.py

+3-23
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,7 @@
99
def home(request):
1010
context_instance=RequestContext(request)
1111
if request.method == 'GET':
12-
data = Comments.objects.all()
13-
comments = []
14-
for obj in data:
15-
commentCurr = {
16-
"user_id": obj.user_id,
17-
"comment": obj.comment,
18-
"post_id": obj.post_id,
19-
}
20-
comments.append(commentCurr)
21-
comments.append({ 'status_code' : 'success' })
22-
return render_to_response('index.html', comments)
12+
return render_to_response('index.html')
2313
elif request.method == 'POST':
2414
data = request.POST.urlencode()
2515
comment = data.split('&')[0].split('=')[1]
@@ -30,17 +20,7 @@ def home(request):
3020
post_id = '1',
3121
comment = comment)
3222
p1.save()
33-
data = Comments.objects.all()
34-
comments = []
35-
for obj in data:
36-
commentCurr = {
37-
"user_id": obj.user_id,
38-
"comment": obj.comment,
39-
"post_id": obj.post_id,
40-
}
41-
comments.append(commentCurr)
42-
comments.append({ 'status_code' : 'success' })
43-
return render_to_response('index.html', comments)
23+
return render_to_response('index.html')
4424

4525
@csrf_exempt
4626
def getComments(request):
@@ -49,7 +29,7 @@ def getComments(request):
4929
for obj in data:
5030
commentCurr = {
5131
"author": obj.user_id,
52-
"text": obj.comment,
32+
"text": obj.comment.replace('+',' '),
5333
"post_id": obj.post_id,
5434
}
5535
comments.append(commentCurr)

0 commit comments

Comments
 (0)