add round and total rounds to update view

This commit is contained in:
Gesche 2021-05-05 21:59:11 +02:00
parent e09f17bdfb
commit e5275db8e8
2 changed files with 5 additions and 1 deletions

View File

@ -5,7 +5,7 @@
<title>Title</title>
</head>
<body>
<h1>Runde {{ current_round }} / {{ total_rounds }}</h1>
<form action="{% url 'writing:update_story_part' story_round_pk=story_round_pk story_pk=story_pk pk=pk %}" method="post">
{% csrf_token %}
{{ form.as_p }}

View File

@ -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