fix after changing null -> blank
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c84ae1334e
commit
dcacff303d
@ -14,7 +14,7 @@
|
||||
<p>Total score: {{ movie.score }}, seen by: {{ movie.seen_score }}.
|
||||
<ul>
|
||||
{% for vote in votes %}
|
||||
<li>{{vote.user.username}} {% if vote.seen %}(seen){% endif %} – {% if vote.vote == 1 %}👍{% elif vote.vote == 0 %}No opinion{% elif vote.vote == -1 %}👎{%endif%}{% if vote.comment is not None %} – {{vote.comment}}{% endif %}</li>
|
||||
<li>{{vote.user.username}} {% if vote.seen %}(seen){% endif %} – {% if vote.vote == 1 %}👍{% elif vote.vote == 0 %}No opinion{% elif vote.vote == -1 %}👎{%endif%}{% if vote.comment != "" %} – {{vote.comment}}{% endif %}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
@ -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, "")
|
||||
|
||||
|
||||
|
@ -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'))
|
||||
|
Loading…
Reference in New Issue
Block a user