From 7724234349a8b7215b9c00d43b5f9a1e8415ae2a Mon Sep 17 00:00:00 2001 From: Pulkit Agrawal Date: Fri, 22 Dec 2023 22:48:50 +0530 Subject: [PATCH 1/3] like and flag fix there was a typo in flagged (has been changed to issue_flaged intentionally). Now likes and flags retain and update. --- website/alternative_views.py | 2 ++ website/templates/_bug.html | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/website/alternative_views.py b/website/alternative_views.py index 8d27a3ddf..a4e4d9796 100644 --- a/website/alternative_views.py +++ b/website/alternative_views.py @@ -66,7 +66,9 @@ def flag_issue2(request, issue_pk): issue_pk = int(issue_pk) issue = Issue.objects.get(pk=issue_pk) userprof = UserProfile.objects.get(user=request.user) + print(UserProfile.objects.filter(issue_flaged=issue)) if userprof in UserProfile.objects.filter(issue_flaged=issue): + print("already flagged") userprof.issue_flaged.remove(issue) else: userprof.issue_flaged.add(issue) diff --git a/website/templates/_bug.html b/website/templates/_bug.html index a5aeaf421..06a15ef74 100644 --- a/website/templates/_bug.html +++ b/website/templates/_bug.html @@ -40,7 +40,7 @@ - {% with user_issue_upvoted_list=bug.user.userprofile.issue_upvoted.all %} + {% with user_issue_upvoted_list=user.userprofile.issue_upvoted.all %} {% if user_issue_upvoted_list and bug in user_issue_upvoted_list %}