{% extends "vantage/base.html" %} {% load static vantage i18n %} {% block head %} {% endblock %} {% block content %}

{% blocktranslate with label=panel.get_label_plural|lower %}Bulk edit {{ label }}{% endblocktranslate %}

{{ scope }}

{% translate "Cancel" %}
{% if messages %} {% endif %} {% comment %} The action attribute is explicit and carries the list page's query string. It has to: the selection is a predicate plus an exclusion set, and the predicate *is* that query string. Dropping it would silently widen "all 40,000 matching this filter" into "all of them", which is the exact class of silent scope change the action layer refuses to make. {% endcomment %}
{% csrf_token %} {% comment %} The selection, re-posted verbatim rather than re-derived. Note what is not here: a list of primary keys for a select-all. That case sends select_all plus whatever was unticked, so the body stays a few hundred bytes whether the edit covers three rows or forty thousand. {% endcomment %} {% for pk in selection.ids %} {% endfor %} {% for pk in selection.excluded %} {% endfor %} {% comment %} The moment this page was drawn. It goes back to the server as the left-hand side of the compare-and-set: a row whose version column has moved past it was edited by somebody else while this page was open, and it is skipped and reported rather than overwritten. See vantage/concurrency.py — the WHERE clause is the check. {% endcomment %}

{% blocktranslate count counter=count %}This will change {{ counter }} record.{% plural %}This will change {{ counter }} records.{% endblocktranslate %}

{% blocktranslate %}Applies to {{ scope }}. Only the fields you tick below are written — everything else on every record is left exactly as it is.{% endblocktranslate %}

{% if form.non_field_errors %} {% endif %}

{% translate "Fields to change" %}

{% for entry in entries %} {% comment %} The tick box is the field's own label, not a control beside it. A blank box means "leave this alone", and that distinction is the whole value of the screen — so the thing you tick and the thing you name are one element, and an unticked field is absent from the form the server builds rather than merely empty in it. {% endcomment %}
{{ entry.bound }} {% if entry.bound.help_text %}

{{ entry.bound.help_text }}

{% endif %} {% if entry.bound.errors %}
    {% for error in entry.bound.errors %}
  • {{ error }}
  • {% endfor %}
{% endif %}
{% endfor %}
{% translate "Nothing is written until you apply." %} {% translate "Cancel" %}
{% endblock %} {% block scripts %} /* Typing in a control ticks its box. Progressive enhancement only: the server decides * what to write from the ticked list alone, so with scripting off the person ticks the * box themselves and the page behaves identically. Nothing here animates, so there is * no motion for prefers-reduced-motion to reduce. */ (function () { document.querySelectorAll('.v-bulk-field').forEach(function (field) { var toggle = field.querySelector('[data-bulk-enable]'); if (!toggle) return; field.addEventListener('input', function (event) { if (event.target !== toggle) toggle.checked = true; }); field.addEventListener('change', function (event) { if (event.target !== toggle) toggle.checked = true; }); }); })(); {% endblock %}