Skip to content

Commit

Permalink
adding user in query
Browse files Browse the repository at this point in the history
  • Loading branch information
JisanAR03 committed Oct 22, 2023
1 parent a186345 commit 648b146
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2052,14 +2052,9 @@ def delete_comment(request):
issue = Issue.objects.get(pk=int_issue_pk)
if request.method == "POST":
all_comment = Comment.objects.filter(issue=issue)
comment = Comment.objects.get(pk=int(request.POST['comment_pk']))
if request.user.username != comment.author:
return HttpResponse("You are not authorized to delete this comment")
try:
show = comment.parent.pk
except:
show = -1
comment.delete()
comment = Comment.objects.get(pk=int(request.POST['comment_pk']),author=request.user.username)
if request.user.username == comment.author:
comment.delete()
context = {
"all_comment": Comment.objects.filter(issue__id=int_issue_pk).order_by("-created_date"),
"object": issue,
Expand Down

0 comments on commit 648b146

Please sign in to comment.