Display bar list with "openness"

This commit is contained in:
Skia 2016-09-04 14:17:49 +02:00
parent c62d3f4f4a
commit 25dea832be
4 changed files with 23 additions and 6 deletions

View File

@ -20,8 +20,15 @@ header {
position: absolute;
top : 0px;
right : 8%;
left: 40%;
background-color:#DDD;
margin: 0 10px;
padding: 0 10px;
}
header ul {
display: inline-block;
list-style-type: none;
margin: 0px;
vertical-align: middle;
}
header a {
display: inline-block;

View File

@ -21,6 +21,18 @@
<a href="{{ url('core:login') }}">{% trans %}Login{% endtrans %}</a> |
<a href="{{ url('core:register') }}">{% trans %}Register{% endtrans %}</a>
{% else %}
<ul>
{% for bar in Counter.objects.filter(type="BAR").all() %}
<li>
{% if bar.is_open() %}
<span style="color: green">&#x2713;</span>
{% else %}
<span style="color: red">&#10007;</span>
{% endif %}
{{ bar }}
</li>
{% endfor %}
</ul>
<a href="{{ url('core:user_profile', user_id=user.id) }}">{{ user.get_display_name() }}</a> |
<a href="{{ url('core:user_tools') }}">{% trans %}Tools{% endtrans %}</a> |
<a href="{{ url('core:logout') }}">{% trans %}Logout{% endtrans %}</a>
@ -40,7 +52,7 @@
<form action="{{ url('set_language') }}" method="post">{% csrf_token %}
<input name="next" value="{{ request.path }}" type="hidden" />
<input name="language" value="{{ language[0] }}" type="hidden" />
<input type="submit" value="{{ language[1]}}" />
<input type="submit" value="{{ language[0]|upper }}" />
</form>
{% endfor %}
</div>

View File

@ -184,10 +184,7 @@ class Counter(models.Model):
return bl[random.randrange(0, len(bl))]
def is_open(self):
response = False
if len(self.get_barmen_list()) > 0:
response = True
return response
return len(self.get_barmen_list()) > 0:
def barman_list(self):
return [b.id for b in self.get_barmen_list()]

View File

@ -111,6 +111,7 @@ TEMPLATES = [
"can_view": "core.views.can_view",
"get_subscriber": "subscription.views.get_subscriber",
"settings": "sith.settings",
"Counter": "counter.models.Counter",
},
"bytecode_cache": {
"name": "default",