Sith/club/templates/club/club_list.jinja
2016-07-19 19:03:16 +02:00

37 lines
974 B
Django/Jinja

{% extends "core/base.jinja" %}
{% block title %}
{% trans %}Club list{% endtrans %}
{% endblock %}
{% macro display_club(club) -%}
<li><a href="{{ url('club:club_view', club_id=club.id) }}">{{ club.name }}</a>
{%- if club.children.all()|length != 0 %}
<ul>
{%- for c in club.children.all() %}
{{ display_club(c) }}
{%- endfor %}
</ul>
{%- endif -%}
</li>
{%- endmacro %}
{% block content %}
{% if user.is_superuser or user.is_in_group(settings.SITH_GROUPS['root']['name']) %}
<p><a href="{{ url('club:club_new') }}">{% trans %}New club{% endtrans %}</a></p>
{% endif %}
{% if club_list %}
<h3>{% trans %}Club list{% endtrans %}</h3>
<ul>
{%- for c in club_list if c.parent is none %}
{{ display_club(c) }}
{%- endfor %}
</ul>
{% else %}
{% trans %}There is no club in this website.{% endtrans %}
{% endif %}
{% endblock %}