Add mark to unvoted movies
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michal Kunc 2023-01-24 20:45:58 +01:00
parent 5221094333
commit a573b80f09
2 changed files with 2 additions and 1 deletions

View File

@ -4,7 +4,7 @@
<h1>Watchlist</h1>
<ul>
{% for movie in object_list %}
<li><a href="{% url 'watchlist:detail' movie.id %}">{{movie.name}}</a> &mdash; {{movie.score}}</li>
<li><a href="{% url 'watchlist:detail' movie.id %}">{{movie.name}}</a>{% if movie in voted_movies %}<sup>*</sup>{% endif %} &mdash; {{movie.score}}</li>
{% endfor %}
</ul>
{% if can_add_movie %}

View File

@ -44,6 +44,7 @@ class IndexView(generic.ListView):
def get_context_data(self):
context = super().get_context_data()
context['can_add_movie'] = self.request.user.has_perm("watchlist.add_movie")
context['voted_movies'] = models.Movie.objects.filter(movievote__user=self.request.user)
return context
class DetailView(generic.DetailView):