{% load i18n %} {{ form.media }}
{% if messages %}
    {% for message in messages %} {{ message }} {% endfor %}
{% endif %}
{% csrf_token %}
{# --- 1. DATA LAYER: Render Hidden Inputs for ALL recipients --- #} {# This ensures the backend receives every selected user, not just the visible one #} {% for choice in form.to %} {% endfor %} {# --- 2. VISUAL LAYER: Show only the first one --- #} {# We make it disabled so the user knows they can't deselect it here #} {% for choice in form.to|slice:":1" %}
{% endfor %} {# --- 3. SUMMARY: Show count of hidden recipients --- #} {% if form.to|length > 1 %}
{# Use simple math to show remaining count #} {% with remaining=form.to|length|add:"-1" %} {% blocktrans count total=remaining %} And {{ total }} other recipient {% plural %} And {{ total }} other recipients {% endblocktrans %} {% endwith %}
{% endif %}
{% if form.to.errors %}
{% for error in form.to.errors %} {{ error }} {% endfor %}
{% endif %}
{{ form.subject }} {% if form.subject.errors %}
{% for error in form.subject.errors %} {{ error }} {% endfor %}
{% endif %}
{{ form.message }} {% if form.message.errors %}
{% for error in form.message.errors %} {{ error }} {% endfor %}
{% endif %}
{% trans "Email will be sent to all selected recipients" %}
{% trans "Loading..." %}
{% trans "Sending email..." %}