fix after changing null -> blank
This commit is contained in:
@@ -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, "")
|
||||
|
||||
|
||||
|
||||
+1
-3
@@ -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'))
|
||||
|
||||
Reference in New Issue
Block a user