Minor fixes

This commit is contained in:
root 2019-11-26 11:34:39 +01:00
parent eb4922ba0b
commit 88204b19af
2 changed files with 8 additions and 2 deletions

View File

@ -55,10 +55,15 @@ class ProfilePageView(views.LoginRequiredMixin, TemplateView):
return context
class UpdateAPIView(views.LoginRequiredMixin, UpdateView):
class UpdateAPIView(views.UserPassesTestMixin, UpdateView):
model = User
form_class = APIForm
template_name = 'main/api_form.html'
raise_exception = True
def test_func(self, user):
user = get_object_or_404(User, pk=self.kwargs.get('pk', 0))
return user == self.request.user
def get_success_url(self):
return reverse_lazy('profile')
@ -305,6 +310,7 @@ class GameRecapView(views.UserPassesTestMixin, TemplateView):
context = super(GameRecapView, self).get_context_data(**kwargs)
game_id = self.kwargs.get('game_pk', 0)
game = get_object_or_404(Game, pk=game_id)
self.request.user.deactive_games()
coord_results = []
distance_total = 0

View File

@ -19,7 +19,7 @@
<div id="map" class="map"></div>
<a class="btn btn-success btn-lg btn-block" href="{% url 'game:new-game' %}" role="button">New Game</a>
<a class="btn btn-success btn-lg btn-block" href="{% url 'home' %}" role="button">Homepage</a>
</div>
</div>