{% extends "base.html" %} {% load static django_bootstrap5 %} {% block title %}Отделы{% endblock %} {% block extra_css %} {% endblock %} {% block content %}

Отделы

Всего: {{ departments|length }}
{% if can_create_departments or perms.employees.add_department or request.user.is_staff or request.user.is_superuser %} {% endif %}
{# поддержка обоих форматов: dict(results) или list #} {% with rows=departments.results|default:departments %} {% for dept in rows %} {% with h=dept.head emp=dept.employees_count|default:0 %} {% url 'employees:department_detail' dept.id as dept_url %}
{% if dept_url %} {{ dept.name }} {% else %} {{ dept.name }} {% endif %}
{% if h %} Руководитель: {{ h.last_name }}{% if h.first_name %} {{ h.first_name }}{% endif %} {% endif %} {% if h and emp %} · {% endif %} {% if emp %}{{ emp }} сотрудников{% endif %}
{% if dept_url %} {% endif %}
{% endwith %} {% empty %}
Отделов пока нет.
{% endfor %} {% endwith %}
Всего сотрудников: 0
{% endblock %}