Minor fixes
This commit is contained in:
parent
eb4922ba0b
commit
88204b19af
@ -55,10 +55,15 @@ class ProfilePageView(views.LoginRequiredMixin, TemplateView):
|
|||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
class UpdateAPIView(views.LoginRequiredMixin, UpdateView):
|
class UpdateAPIView(views.UserPassesTestMixin, UpdateView):
|
||||||
model = User
|
model = User
|
||||||
form_class = APIForm
|
form_class = APIForm
|
||||||
template_name = 'main/api_form.html'
|
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):
|
def get_success_url(self):
|
||||||
return reverse_lazy('profile')
|
return reverse_lazy('profile')
|
||||||
@ -305,6 +310,7 @@ class GameRecapView(views.UserPassesTestMixin, TemplateView):
|
|||||||
context = super(GameRecapView, self).get_context_data(**kwargs)
|
context = super(GameRecapView, self).get_context_data(**kwargs)
|
||||||
game_id = self.kwargs.get('game_pk', 0)
|
game_id = self.kwargs.get('game_pk', 0)
|
||||||
game = get_object_or_404(Game, pk=game_id)
|
game = get_object_or_404(Game, pk=game_id)
|
||||||
|
self.request.user.deactive_games()
|
||||||
|
|
||||||
coord_results = []
|
coord_results = []
|
||||||
distance_total = 0
|
distance_total = 0
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<div id="map" class="map"></div>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user