{% extends "fastapi_panel/base.html" %} {% macro upload_form(first) %}
{% if first %}Download template{% endif %} Cancel
{% endmacro %} {% block content %}

{{ title }}

{% if error %}{% endif %} {% if report %}
{% set counts = report.counts %}
{{ counts.add }} new {{ counts.change }} changed {{ counts.same }} unchanged {% if counts.error %}{{ counts.error }} with errors{% endif %}
{% if report.is_valid %}

Nothing has been saved yet. Check the rows below, then import.

{% else %} {% endif %} {% if report.ignored %}

Ignored columns: {{ report.ignored|join(", ") }}

{% endif %} {% if report.is_valid %}
{% endif %}
{% for column in report.columns %}{% endfor %} {% for row in preview %} {% if row.errors %} {% else %} {% for cell in row.cells %}{% endfor %} {% endif %} {% endfor %}
LineResult{{ column }}
{{ row.line }} {{ {"add": "new", "change": "changed", "same": "unchanged", "error": "error"}[row.status] }}{{ row.errors|join(" ") }}{{ cell|truncate(80) }}
{% if hidden_rows %}

And {{ hidden_rows }} more rows.

{% endif %}
{{ upload_form(False) }}
{% else %}

The first line names the columns: {{ columns|join(", ") }}. Add an {{ pk_label }} column to update existing records. You'll see a preview before anything is saved.

{{ upload_form(True) }}
{% endif %} {% endblock %}