Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
override import template from suit, to add our warning message, fixes #4
- Loading branch information
1 parent
7ff380e
commit 1430ad9
Showing
2 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
97 changes: 97 additions & 0 deletions
97
voseq/core/templates/admin/public_interface/vouchers/batch_import.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
{% extends "admin/import_export/base.html" %} | ||
{% load url from future %} | ||
{% load i18n admin_urls import_export_tags %} | ||
|
||
{% block breadcrumbs_last %} | ||
{% trans "Import" %} | ||
{% endblock %} | ||
|
||
{% block content %} | ||
|
||
{% if not confirm_form %} | ||
<form action="{{ form_url }}" method="POST" id="{{ opts.module_name }}_form" enctype="multipart/form-data" class="form-horizontal"> | ||
{% csrf_token %} | ||
|
||
|
||
<div class="alert alert-info"> | ||
{% trans "This importer will import the following fields: " %} | ||
{% for f in fields %} | ||
<code>{{ f }}</code> | ||
{% endfor %} | ||
</div> | ||
|
||
<div class="alert alert-danger"> | ||
{% trans "Make sure to include those fieldnames as headers in the first row of your data files!" %} | ||
</div> | ||
|
||
{% include 'suit/form_as_fieldset.html' %} | ||
<div class="submit-row submit-row-bottom"> | ||
<input type="submit" value="{% trans "Import" %}" class="btn btn-info"/> | ||
</div> | ||
|
||
</form> | ||
{% endif %} | ||
|
||
{% if result %} | ||
{% if result.has_errors %} | ||
<div class="alert alert-error alert-block"> | ||
<h4>{% trans "Errors" %}</h4> | ||
<ul> | ||
{% for error in result.base_errors %} | ||
<li>{{ error.error }}</li> | ||
{% endfor %} | ||
{% for line, errors in result.row_errors %} | ||
{% for error in errors %} | ||
<li> | ||
{% trans "Line number" %}: {{ line }} - {{ error.error }} | ||
<pre class="traceback">{{ error.traceback|linebreaks }}</pre> | ||
</li> | ||
{% endfor %} | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
{% else %} | ||
|
||
<h2>{% trans "Preview" %}</h2> | ||
<table class="table table-bordered table-hover table-condensed table-striped"> | ||
<thead> | ||
<tr> | ||
<th></th> | ||
{% for field in fields %} | ||
<th>{{ field }}</th> | ||
{% endfor %} | ||
</tr> | ||
</thead> | ||
{% for row in result.rows %} | ||
<tr> | ||
<td> | ||
{% if row.import_type == 'new' %} | ||
{% trans "New" %} | ||
{% elif row.import_type == 'skip' %} | ||
{% trans "Skipped" %} | ||
{% elif row.import_type == 'delete' %} | ||
{% trans "Delete" %} | ||
{% elif row.import_type == 'update' %} | ||
{% trans "Update" %} | ||
{% endif %} | ||
</td> | ||
{% for field in row.diff %} | ||
<td> | ||
{{ field }} | ||
</td> | ||
{% endfor %} | ||
</tr> | ||
{% endfor %} | ||
</table> | ||
{% endif %} | ||
|
||
{% endif %} | ||
|
||
{% if confirm_form %} | ||
<form action="{% url opts|admin_urlname:"process_import" %}" method="POST"> | ||
{% csrf_token %} | ||
{{ confirm_form.as_p }} | ||
<input class="btn btn-success" name="confirm" type="submit" value="{% trans "Confirm import" %}"> | ||
</form> | ||
{% endif %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters