diff --git a/templates/watchlist/movie_detail.html b/templates/watchlist/movie_detail.html index fd88e08..381014b 100644 --- a/templates/watchlist/movie_detail.html +++ b/templates/watchlist/movie_detail.html @@ -14,7 +14,7 @@

Total score: {{ movie.score }}, seen by: {{ movie.seen_score }}.

{% endif %} diff --git a/watchlist/tests/test_views.py b/watchlist/tests/test_views.py index 291e08f..bd527d2 100644 --- a/watchlist/tests/test_views.py +++ b/watchlist/tests/test_views.py @@ -166,10 +166,10 @@ class VoteTests(TestCase): with self.subTest(comment=comment): response = self.client.post(reverse('watchlist:vote', args=(m.id,)), data={"vote": "0", "comment": comment}) mv = m.movievote_set.get(user=self.user) - self.assertEqual(mv.comment, None if comment == "" else comment) + self.assertEqual(mv.comment, comment) with self.subTest(comment=None): response = self.client.post(reverse('watchlist:vote', args=(m.id,)), data={"vote": "0"}) mv = m.movievote_set.get(user=self.user) - self.assertEqual(mv.comment, None) + self.assertEqual(mv.comment, "") diff --git a/watchlist/views.py b/watchlist/views.py index 99ba2a0..36c36eb 100644 --- a/watchlist/views.py +++ b/watchlist/views.py @@ -56,9 +56,7 @@ def vote(request, pk): user_vote.vote = request.POST['vote'] user_vote.seen = request.POST.get('seen', False) == "on" comment = request.POST.get('comment', '').strip() - if comment != '' or user_vote.comment is not None: - if comment == '': - comment = None + if comment != '' or user_vote.comment != "": user_vote.comment = comment user_vote.save() return HttpResponseRedirect(reverse('watchlist:index'))