{% extends "console/base.html" %} {% load ostium_ui %} {% block title %}导入用户{% endblock %} {% block breadcrumb %}用户 / 导入{% endblock %} {% block page_header %}
{% icon "upload" "w-3.5 h-3.5" %} Bulk import

导入用户

从 CSV / JSON 导出文件批量创建用户。已有用户名会跳过,新用户会生成独立凭据。

{% icon "arrow-left" %} 返回用户
{% endblock %} {% block content %}
{% icon "upload" %} 选择文件
{% csrf_token %} {% if form.non_field_errors %}
{{ form.non_field_errors }}
{% endif %}
{{ form.file }} {{ form.file.errors }} {{ form.file.help_text }}
{{ form.dry_run.errors }} {{ form.dry_run.help_text }}
{% icon "check" %} 导入结果
{% if outcome %} {% if outcome.dry_run %}预览{% else %}已执行{% endif %} {% endif %}
{% if outcome %}
将创建 / 已创建
{{ outcome.created }}
跳过已有
{{ outcome.skipped }}
错误
{{ outcome.errors|length }}
{% if outcome.errors %}
{% icon "alert" %}
部分行未导入:
    {% for error in outcome.errors|slice:":20" %}
  • {{ error }}
  • {% endfor %}
{% endif %} {% if outcome.dry_run %}

当前只是预览,未写入数据库。取消「仅预览」后重新提交即可执行。

{% endif %} {% else %}
{% icon "upload" %}
等待文件
建议先勾选「仅预览」,确认跳过和错误数量后再正式导入。
{% endif %}
{% endblock %}