{% if not user.is_authenticated %}
{% trans %}Login{% endtrans %} {% trans %}Register{% endtrans %}
{% else %}
    {% cache 100 "counters_activity" %} {# It would be cleaner to handle the timeout with django-celery-beat, but doing it here is simpler and less error-prone #} {% do Counter.objects.filter(type="BAR").handle_timeout() %} {% endcache %} {% for bar in Counter.objects.annotate_has_barman(user).annotate_is_open().filter(type="BAR") %}
  • {# If the user is a barman, we redirect him directly to the barman page else we redirect him to the activity page #} {% if bar.has_annotated_barman %} {% else %} {% endif %} {% if bar.is_open %} {% else %} {% endif %} {{ bar }}
  • {% endfor %}
{% endif %}
{% for language in LANGUAGES %}
{% csrf_token %}
{% endfor %}