smoll fix to new game logic

This commit is contained in:
root 2019-08-31 17:54:46 +02:00
parent eebd6a5ed6
commit 28e94893c5

View File

@ -39,6 +39,7 @@ class HomePageView(TemplateView):
if user.is_authenticated:
if user.api_key:
context['has_api_key'] = True
try:
game = Game.objects.filter(user=user, active=True)
if game and game.exists():
game = game.first()
@ -49,6 +50,8 @@ class HomePageView(TemplateView):
if not round.guess_lat or not round.guess_lng:
context['existing_round'] = round
break
except:
pass
else:
context['has_api_key'] = False
return context
@ -79,7 +82,7 @@ class ContributeView(views.LoginRequiredMixin, CreateView):
self.object = form.save(commit=False)
self.object.user = self.request.user
self.object.save()
messages.success(self.request, "Thank you so much for helping the site, you coordinates have been added.")
messages.success(self.request, "Your coordinates have been added.")
return redirect(self.get_success_url())