add round and total rounds to update view

master
Gesche 3 years ago
parent e09f17bdfb
commit e5275db8e8

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

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

Loading…
Cancel
Save