diff --git a/blt/urls.py b/blt/urls.py index e9e40ef3f..133b2afa7 100644 --- a/blt/urls.py +++ b/blt/urls.py @@ -285,10 +285,12 @@ re_path( r"^like_issue/(?P\d+)/$", website.views.like_issue, name="like_issue" ), + re_path( + r"^dislike_issue/(?P\d+)/$", website.views.dislike_issue, name="dislike_issue" + ), re_path( r"^flag_issue/(?P\d+)/$", website.views.flag_issue, name="flag_issue" ), - re_path( r"^like_issue2/(?P\d+)/$", like_issue2, name="like_issue2" ), diff --git a/website/migrations/0081_userprofile_issue_downvoted.py b/website/migrations/0081_userprofile_issue_downvoted.py new file mode 100644 index 000000000..832f532d7 --- /dev/null +++ b/website/migrations/0081_userprofile_issue_downvoted.py @@ -0,0 +1,20 @@ +# Generated by Django 4.2.7 on 2023-11-17 09:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("website", "0080_alter_issue_team_members"), + ] + + operations = [ + migrations.AddField( + model_name="userprofile", + name="issue_downvoted", + field=models.ManyToManyField( + blank=True, related_name="downvoted", to="website.issue" + ), + ), + ] diff --git a/website/models.py b/website/models.py index 95d2b281e..055b0a375 100644 --- a/website/models.py +++ b/website/models.py @@ -448,6 +448,7 @@ class UserProfile(models.Model): max_digits=10, decimal_places=2, null=True, blank=True ) issue_upvoted = models.ManyToManyField(Issue, blank=True, related_name="upvoted") + issue_downvoted = models.ManyToManyField(Issue, blank=True, related_name="downvoted") issue_saved = models.ManyToManyField(Issue, blank=True, related_name="saved") issue_flaged = models.ManyToManyField(Issue,blank=True,related_name="flaged") issues_hidden = models.BooleanField(default=False) diff --git a/website/templates/_flags.html b/website/templates/_flags.html index 49ab32d34..62f1a10f2 100644 --- a/website/templates/_flags.html +++ b/website/templates/_flags.html @@ -2,11 +2,11 @@ {% if request.user.is_authenticated %} - Flag {{ flags }} + Flag {{ flags }} {% else %} {% endif %} diff --git a/website/templates/_likes.html b/website/templates/_likes.html deleted file mode 100644 index 7f2ea5f08..000000000 --- a/website/templates/_likes.html +++ /dev/null @@ -1,35 +0,0 @@ -{% load gravatar %} - -{% if request.user.is_authenticated %} - -{% else %} - -{% endif %} - -{% if likes %} - Liked By -{% endif %} - - \ No newline at end of file diff --git a/website/templates/_likes_and_dislikes.html b/website/templates/_likes_and_dislikes.html new file mode 100644 index 000000000..78c0600d9 --- /dev/null +++ b/website/templates/_likes_and_dislikes.html @@ -0,0 +1,70 @@ +{% load gravatar %} + +{% if request.user.is_authenticated %} + +{% else %} + +{% endif %} + +{% if likers %} + Liked By +{% endif %} + + + + +{% if request.user.is_authenticated %} + + {{ dislikes }} + +{% else %} + +{% endif %} + +{% if dislikers %} + Disliked By +{% endif %} + + \ No newline at end of file diff --git a/website/templates/issue.html b/website/templates/issue.html index 48e5050e5..10d831379 100644 --- a/website/templates/issue.html +++ b/website/templates/issue.html @@ -85,7 +85,8 @@ .bookmark, .copy-btn, .flag_btn a.flaged-by, - .like_btn a.liked-by { + .like_btn a.liked-by, + .dislike_btn a.disliked-by { vertical-align: top; } @@ -183,8 +184,8 @@