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