{% if last %}
{{ last.created_at|date:"d.m.Y H:i" }} ·
{{ last.author.get_full_name|default:last.author.username }}:
{{ last.content|default:"(вложение)"|truncatechars:120 }}
{% else %}
Сообщений пока нет.
{% endif %}
{% endwith %}
{% endif %}
{% endfor %}
{# ===== 3) ЛИЧНЫЕ ===== #}
Личные
Нет личных чатов
{% for chat in chats %}
{% if chat.type == 'private' %}
{% with last=chat.last_message.0 %}
{% with p0=chat.participants.all.0 p1=chat.participants.all.1 %}
{% if p0 and p0 != user and p0.avatar %}
{% elif p1 and p1 != user and p1.avatar %}
{% else %}
{% endif %}
{% endwith %}