Browse files

Add ajax handlers to delete

  • Loading branch information...
1 parent 34e839b commit c7cd93a4cea450153f2f4d0fd98fe1e3f92cd3f0 @paltman paltman committed Apr 26, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 dialogos/views.py
View
5 dialogos/views.py
@@ -84,4 +84,9 @@ def delete_comment(request, comment_id):
obj = comment.content_object
if can_delete(request.user, comment):
comment.delete()
+ if request.is_ajax():
+ return HttpResponse(json.dumps({"status": "OK"}))
+ else:
+ if request.is_ajax():
+ return HttpResponse(json.dumps({"status": "ERROR", "errors": "You do not have permission to delete this comment."}))
return redirect(obj)

0 comments on commit c7cd93a

Please sign in to comment.