{% extends "outreach/admin/base.html" %} {% load i18n %} {% block page_title %}{% trans "Import" %}{% endblock %} {% block breadcrumbs_last %}{% endblock %} {% block content %}
{% csrf_token %}
{{ form.import_file.errors }} {{ form.import_file.label_tag }} {{ form.import_file }} {% trans "A UTF-8 CSV file with a header row and an email column." %}
{% if form.update_existing %}
{{ form.update_existing.help_text }}
{% endif %}
{% trans "Cancel" %}
{% if preview %} {% if preview.invalid_rows %}

{% trans "Some rows are invalid" %}

{% trans "Nothing was imported. Correct these rows in your file, then upload it again." %}

{% for column in columns %}{% endfor %} {% for row in preview.invalid_rows %} {% for cell in row.cells %}{% endfor %} {% endfor %}
{% trans "Line" %} {% trans "Errors" %}{{ column }}
{{ row.line }}
    {% for error in row.errors %}
  • {{ error }}
  • {% endfor %}
{{ cell }}
{% else %}

{% trans "Preview" %}

{% blocktrans with new=preview.new_rows|length update=preview.update_rows|length kept=preview.kept_rows|length repeated=preview.repeated_rows|length %}{{ new }} new, {{ update }} to update, {{ kept }} kept as they are, {{ repeated }} repeated in the file.{% endblocktrans %}

{% for column in columns %}{% endfor %} {% for row in preview.rows %} {% for cell in row.cells %}{% endfor %} {% endfor %}
{{ column }}
{{ row.status.label }} {% for field_name, change in row.changes.items %}
{{ field_name }}: {{ change.0|default:"-" }} → {{ change.1 }}{% endfor %}
{{ cell }}
{% if preview.new_rows or preview.update_rows %}
{% csrf_token %} {{ confirm_form }}

{% trans "If you are satisfied with the preview, confirm the import." %}

{% else %}

{% trans "Every row already exists, so there is nothing to import." %}

{% endif %}
{% endif %} {% endif %} {% endblock %}