fix view logic while no location
This commit is contained in:
parent
bede78cf84
commit
bf20e232d9
@ -1,3 +1,3 @@
|
|||||||
body {
|
body {
|
||||||
padding-top: 50px;
|
padding-top: 55px;
|
||||||
}
|
}
|
||||||
|
@ -27,11 +27,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="navbar" class="collapse navbar-collapse">
|
<div id="navbar" class="collapse navbar-collapse">
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
<li class="active"><a href="/billard/">Tische</a></li>
|
<li class="{% ifequal request.path '/billard/' %}active{% endifequal %}"><a href="{% url "carom_index" %}">Tische</a></li>
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
<li><a href="{% url 'logout' %}">Abmelden</a></li>
|
<li class="{% ifequal request.path '/logout/' %}active{% endifequal %}"><a href="{% url 'logout' %}">Abmelden</a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li><a href="{% url 'login' %}">Anmelden</a></li>
|
<li class="{% ifequal request.path '/login/' %}active{% endifequal %}"><a href="{% url 'login' %}">Anmelden</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
</div><!--/.nav-collapse -->
|
</div><!--/.nav-collapse -->
|
||||||
|
@ -45,8 +45,11 @@ def index(request):
|
|||||||
loc = request.GET['loc']
|
loc = request.GET['loc']
|
||||||
if not Location.objects.filter(users__id=request.user.id).filter(id=loc).exists():
|
if not Location.objects.filter(users__id=request.user.id).filter(id=loc).exists():
|
||||||
resp = redirect('carom_index')
|
resp = redirect('carom_index')
|
||||||
|
if min_loc is not None:
|
||||||
resp['Location'] += '?loc={}'.format(str(min_loc))
|
resp['Location'] += '?loc={}'.format(str(min_loc))
|
||||||
return resp
|
return resp
|
||||||
|
else:
|
||||||
|
return render(request, 'billard/index.html')
|
||||||
if loc is None:
|
if loc is None:
|
||||||
loc = min_loc
|
loc = min_loc
|
||||||
locations = Location.objects.filter(users__id=request.user.id).order_by('code')
|
locations = Location.objects.filter(users__id=request.user.id).order_by('code')
|
||||||
|
Loading…
Reference in New Issue
Block a user