diff --git a/geogame/main/views.py b/geogame/main/views.py index c145b60..0b6fdb8 100644 --- a/geogame/main/views.py +++ b/geogame/main/views.py @@ -162,11 +162,14 @@ class NewGameView(views.LoginRequiredMixin, View): ) -class RoundView(views.LoginRequiredMixin, UpdateView): +class RoundView(views.UserPassesTestMixin, UpdateView): model = GameRound form_class = GuessForm template_name = 'main/round.html' + def test_func(self, *args, **kwargs): + return self.request.user == get_object_or_404(Game, pk=self.kwargs.get('game_pk', 0)).user + def get_object(self): round_id = self.kwargs.get('round_pk', 0) return get_object_or_404(GameRound, pk=round_id) diff --git a/geogame/templates/game_base.html b/geogame/templates/game_base.html index 176f390..a670e66 100644 --- a/geogame/templates/game_base.html +++ b/geogame/templates/game_base.html @@ -11,7 +11,9 @@ Geogame - + + +