Minor tweaks to templates, permissions fix
This commit is contained in:
parent
a54ec52f52
commit
c61adb84e2
@ -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)
|
||||
|
@ -11,7 +11,9 @@
|
||||
<link rel="shortcut icon" type="image/png" href="{% static 'favicon.ico' %}"/>
|
||||
<title>Geogame</title>
|
||||
</head>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<img id="logo" src="{% static 'brand.png' %}"></img>
|
||||
@ -21,11 +23,11 @@
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<li class="nav-item {% if request.path == "/" %} active {% endif %}">
|
||||
<li class="nav-item {% if request.resolver_match.url_name == 'home' %} active {% endif %}">
|
||||
<a href="{% url 'home' %}" class="nav-link">Home</a>
|
||||
</li>
|
||||
{% if user.is_authenticated %}
|
||||
<li class="nav-item">
|
||||
<li class="nav-item {% if request.resolver_match.url_name == 'profile' %} active {% endif %}">
|
||||
<a href="{% url 'profile' %}" class="nav-link">Profile</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
@ -50,8 +52,4 @@
|
||||
{% endif %}
|
||||
{% block content %}
|
||||
{% endblock content %}
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
</body>
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base.html' %}
|
||||
{% extends 'game_base.html' %}
|
||||
{% load staticfiles%}
|
||||
|
||||
{% block content %}
|
||||
|
@ -36,7 +36,8 @@
|
||||
You must be logged in to play the game. Please read the FAQ for more info.
|
||||
</div>
|
||||
<button type="button" class="btn btn-info btn-lg btn-block" disabled>Continue Last Game</button>
|
||||
<button type="button" class="btn btn-success btn-lg btn-block" disabled>New Game</button>
|
||||
<button type="button" class="btn btn-success btn-lg btn-block" disabled>New Random Game</button>
|
||||
<button type="button" class="btn btn-warning btn-lg btn-block" disabled>View Challenges</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user