From e5275db8e8f79d756cc5121a14a054c76361d698 Mon Sep 17 00:00:00 2001 From: Gesche Gierse Date: Wed, 5 May 2021 21:59:11 +0200 Subject: [PATCH] add round and total rounds to update view --- .../writingtogether/templates/writingtogether/story_part.html | 2 +- stories/writingtogether/views.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/stories/writingtogether/templates/writingtogether/story_part.html b/stories/writingtogether/templates/writingtogether/story_part.html index 494d145..2d72b8b 100644 --- a/stories/writingtogether/templates/writingtogether/story_part.html +++ b/stories/writingtogether/templates/writingtogether/story_part.html @@ -5,7 +5,7 @@ Title - +

Runde {{ current_round }} / {{ total_rounds }}

{% csrf_token %} {{ form.as_p }} diff --git a/stories/writingtogether/views.py b/stories/writingtogether/views.py index cc43727..e16c535 100644 --- a/stories/writingtogether/views.py +++ b/stories/writingtogether/views.py @@ -67,6 +67,10 @@ class StoryPartUpdate(LoginRequiredMixin, UpdateView): def get_context_data(self, **kwargs): context = super(StoryPartUpdate, self).get_context_data(**kwargs) + context.update({ + 'current_round': self.object.turn_number + 1, + 'total_rounds': self.object.part_of.part_of_round.number_of_rounds + }) context.update(self.kwargs) return context