1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
{% extends "base.html" %}
{% load i18n inline_formset %}
{% block content %}
<h2>{% trans "Import step by step" %}</h2>
<h3>{{import.name}} – {% trans "line " %} {{line_number_displayed}}</h3>
{% if errors %}
<div class="alert alert-danger" role="alert">
<p>{% trans "The following error(s) has been encountered while parsing the source file:" %}</p>
<ul>{% for error in errors %}
<li>{{error}}</li>
{% endfor %}</ul>
</div>
{% if values %}
<table class="table table-striped">
{% for header, value in values %}
<tr>
<th>{{header}}</th>
<td>{{value}}</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% else %}
{% if new_objects %}
<h4>{% trans "Objects to be created" %}</h4>
<div>
<table class="table table-striped">
<tr>
<th>{% trans "Path" %}</th>
<th>{% trans "Type" %}</th>
<th>{% trans "Values" %}</th>
</tr>
{% for path, cls, values in new_objects %}
<tr>
<td>{{path}}</td>
<td>{{cls.get_verbose_name}}</td>
<td>{% for k, value in values.items %}<div class="row">
<div class="col-6"><strong>{{k}}{% trans ":"%}</strong></div>
<div class="col-6">{{value}}</div>
</div>{% endfor %}
</td>
</tr>
{% endfor %}
</table>
</div>
{% endif %}
{% if updated_objects %}
<h4>{% trans "Objects to be updated" %}</h4>
<div>
<table class="table table-striped">
<tr>
<th>{% trans "Path" %}</th>
<th>{% trans "Object" %}</th>
<th>{% trans "Matching values" %}</th>
<th>{% trans "Updated values" %}</th>
</tr>
{% for path, obj, values, updated_values in updated_objects %}
<tr>
<td>{{path}}</td>
<td>{{obj}} ({{obj.get_verbose_name}})</td>
<td>{% for k, value in values.items %}<div class="row">
<div class="col-6"><strong>{{k}}{% trans ":"%}</strong></div>
<div class="col-6">{{value}}</div>
</div>{% endfor %}
<td>{% for k, value in updated_values.items %}<div class="row">
<div class="col-6"><strong>{{k}}{% trans ":"%}</strong></div>
<div class="col-6">{{value}}</div>
</div>{% endfor %}
</td>
</tr>
{% endfor %}
</table>
</div>
{% endif %}
<div>
<table class="table table-striped">
<tr>
<th>{% trans "Column number" %}</th>
<th>{% trans "Name" %}</th>
<th>{% trans "Raw CSV value" %}</th>
<th>{% trans "Current value" %}</th>
<th>{% trans "New value" %}</th>
{% comment %}<th>{% trans "Merged value" %}</th>{% endcomment %}
</tr>
{% for idx, name, raw, interpreted in values %}<tr>
<td>{{idx}}</td>
<td>{{name|safe}}</td>
<td>{{raw}}</td>
<td></td>
<td>{{interpreted}}</td>
</tr>{% endfor %}
</table>
</div>
{% endif %}
{% endblock %}
|