django-spreadsheets 1.4.0__tar.gz → 1.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/PKG-INFO +1 -1
- django_spreadsheets-1.4.2/django_spreadsheets/__init__.py +1 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/base_config.py +14 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/forms.py +1 -1
- django_spreadsheets-1.4.2/django_spreadsheets/locale/fr/LC_MESSAGES/django.mo +0 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/locale/fr/LC_MESSAGES/django.po +6 -3
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/templates/spreadsheets/base.html +30 -7
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/templates/spreadsheets/wizard.html +8 -8
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/validation.py +0 -11
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/pyproject.toml +3 -3
- django_spreadsheets-1.4.0/django_spreadsheets/__init__.py +0 -1
- django_spreadsheets-1.4.0/django_spreadsheets/locale/fr/LC_MESSAGES/django.mo +0 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/LICENSE +0 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/README.md +0 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/admin.py +0 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/apps.py +0 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/autodiscover.py +0 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/conf/__init__.py +0 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/conf/settings.py +0 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/constants.py +0 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/errors.py +0 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/exceptions.py +0 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/exporter.py +0 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/importer.py +0 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/registry.py +0 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/shortcuts.py +0 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/templates/spreadsheets/done.html +0 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/templates/spreadsheets/export_index.html +0 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/templates/spreadsheets/import_index.html +0 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/urls.py +0 -0
- {django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/views.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.4.2"
|
|
@@ -47,6 +47,20 @@ class SheetConfig(metaclass=IndexedAttributesMeta):
|
|
|
47
47
|
```
|
|
48
48
|
"""
|
|
49
49
|
|
|
50
|
+
def __init__(self, *args, **kwargs):
|
|
51
|
+
super().__init__(*args, **kwargs)
|
|
52
|
+
|
|
53
|
+
# Replace functions found in formula1 and formula2 by their return values
|
|
54
|
+
for column_name, column_config in self.items():
|
|
55
|
+
validation_config = column_config.get("validation")
|
|
56
|
+
if validation_config:
|
|
57
|
+
formula1 = validation_config.get("formula1")
|
|
58
|
+
if callable(formula1):
|
|
59
|
+
self[column_name]["validation"]["formula1"] = formula1()
|
|
60
|
+
formula2 = validation_config.get("formula2")
|
|
61
|
+
if callable(formula2):
|
|
62
|
+
self[column_name]["validation"]["formula2"] = formula2()
|
|
63
|
+
|
|
50
64
|
def __getitem__(self, key):
|
|
51
65
|
return getattr(self, key)
|
|
52
66
|
|
|
@@ -64,7 +64,7 @@ class FileForm(forms.Form):
|
|
|
64
64
|
if self.importer.import_errors:
|
|
65
65
|
raise forms.ValidationError(
|
|
66
66
|
_(
|
|
67
|
-
"
|
|
67
|
+
"Errors were encountered during file import. More information on these errors can be found below. Please correct the errors and try importing the file again."
|
|
68
68
|
)
|
|
69
69
|
)
|
|
70
70
|
|
|
@@ -8,7 +8,7 @@ msgid ""
|
|
|
8
8
|
msgstr ""
|
|
9
9
|
"Project-Id-Version: PACKAGE VERSION\n"
|
|
10
10
|
"Report-Msgid-Bugs-To: \n"
|
|
11
|
-
"POT-Creation-Date: 2024-
|
|
11
|
+
"POT-Creation-Date: 2024-10-07 16:46+0200\n"
|
|
12
12
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
13
13
|
"Last-Translator: Adrien DELHORME <ad@kapt.mobi>\n"
|
|
14
14
|
"Language-Team: Kapt <dev@kapt.mobi>\n"
|
|
@@ -134,8 +134,8 @@ msgstr "Votre fichier doit être formaté comme le modèle version {config_versi
|
|
|
134
134
|
msgid "No file were provided."
|
|
135
135
|
msgstr "Aucun fichier n’a été fourni."
|
|
136
136
|
|
|
137
|
-
msgid "
|
|
138
|
-
msgstr "
|
|
137
|
+
msgid "Errors were encountered during file import. More information on these errors can be found below. Please correct the errors and try importing the file again."
|
|
138
|
+
msgstr "Des erreurs ont été rencontrées lors de l’import du fichier. Vous trouverez plus d’informations ci-dessous. Veuillez corriger les erreurs et essayer d’importer le fichier de nouveau."
|
|
139
139
|
|
|
140
140
|
msgid "No file were provided"
|
|
141
141
|
msgstr "Aucun fichier n’a été fourni."
|
|
@@ -180,6 +180,9 @@ msgstr "Erreurs"
|
|
|
180
180
|
msgid "Sheet"
|
|
181
181
|
msgstr "Feuille"
|
|
182
182
|
|
|
183
|
+
msgid "see details"
|
|
184
|
+
msgstr "voir les détails"
|
|
185
|
+
|
|
183
186
|
#, python-format
|
|
184
187
|
msgid "%(counter)s problem"
|
|
185
188
|
msgid_plural "%(counter)s problems"
|
|
@@ -28,28 +28,51 @@
|
|
|
28
28
|
margin-right: 1rem;
|
|
29
29
|
}
|
|
30
30
|
ul.spreadsheet-nested-errors {
|
|
31
|
+
--title-bg: #dc3545;
|
|
32
|
+
--title-fg: #fff;
|
|
33
|
+
}
|
|
34
|
+
ul.spreadsheet-nested-warnings {
|
|
35
|
+
--title-bg: #ffc107;
|
|
36
|
+
--title-fg: #000;
|
|
37
|
+
}
|
|
38
|
+
ul.spreadsheet-nested-errors,
|
|
39
|
+
ul.spreadsheet-nested-warnings {
|
|
31
40
|
margin: 2px 0 0 0;
|
|
32
41
|
padding: 0;
|
|
33
42
|
ul { padding: 0; }
|
|
34
|
-
li.spreadsheet-sheet-item,
|
|
43
|
+
li.spreadsheet-sheet-item,
|
|
44
|
+
li.spreadsheet-error-item,
|
|
45
|
+
li.spreadsheet-warning-item {
|
|
35
46
|
list-style-type: none;
|
|
36
47
|
line-height: initial;
|
|
37
48
|
}
|
|
38
|
-
li.spreadsheet-error-item
|
|
49
|
+
li.spreadsheet-error-item,
|
|
50
|
+
li.spreadsheet-warning-item {
|
|
39
51
|
background-color: white;
|
|
40
52
|
}
|
|
41
53
|
summary {
|
|
42
54
|
padding: 8px;
|
|
43
|
-
background: var(--darkened-bg);
|
|
44
|
-
color: var(--body-fg);
|
|
45
55
|
cursor: pointer;
|
|
56
|
+
background: var(--title-bg);
|
|
57
|
+
color: var(--title-fg);
|
|
58
|
+
|
|
59
|
+
.detail-link {
|
|
60
|
+
color: var(--title-bg);
|
|
61
|
+
background-color: var(--title-fg);
|
|
62
|
+
border-radius: 3px;
|
|
63
|
+
padding: .1rem .4rem;
|
|
64
|
+
margin-left: 2rem;
|
|
65
|
+
}
|
|
46
66
|
}
|
|
47
|
-
.spreadsheet-error-title
|
|
67
|
+
.spreadsheet-error-title,
|
|
68
|
+
.spreadsheet-warning-title {
|
|
48
69
|
display: flex;
|
|
49
70
|
justify-content: space-between;
|
|
50
71
|
}
|
|
51
|
-
.spreadsheet-error-count
|
|
52
|
-
|
|
72
|
+
.spreadsheet-error-count,
|
|
73
|
+
.spreadsheet-warning-count { float: right; }
|
|
74
|
+
ul.spreadsheet-errors-list,
|
|
75
|
+
ul.spreadsheet-warnings-list {
|
|
53
76
|
margin-top: 8px;
|
|
54
77
|
margin-bottom: 8px;
|
|
55
78
|
padding: 8px 8px 1rem 8px;
|
|
@@ -63,14 +63,14 @@
|
|
|
63
63
|
{% for sheet in errors_by_sheet %}
|
|
64
64
|
<li class="spreadsheet-sheet-item">
|
|
65
65
|
<details>
|
|
66
|
-
<summary>{% translate "Sheet" %} "{{ sheet.grouper }}"</summary>
|
|
66
|
+
<summary>{% translate "Sheet" %} "{{ sheet.grouper }}" <span class="detail-link">{% translate "see details" %}</span></summary>
|
|
67
67
|
<ul>
|
|
68
68
|
{% regroup sheet.list by title as errors_by_title %}
|
|
69
69
|
{% for title in errors_by_title %}
|
|
70
70
|
<li class="spreadsheet-error-item">
|
|
71
71
|
<details>
|
|
72
72
|
<summary>
|
|
73
|
-
{{ title.grouper }} <span class="spreadsheet-error-count">{% blocktranslate count counter=title.list|length %}{{ counter }} problem{% plural %}{{ counter }} problems{% endblocktranslate %}</span>
|
|
73
|
+
{{ title.grouper }} <span class="detail-link">{% translate "see details" %}</span> <span class="spreadsheet-error-count">{% blocktranslate count counter=title.list|length %}{{ counter }} problem{% plural %}{{ counter }} problems{% endblocktranslate %}</span>
|
|
74
74
|
</summary>
|
|
75
75
|
<ul class="spreadsheet-errors-list">
|
|
76
76
|
{% for error in title.list %}
|
|
@@ -91,25 +91,25 @@
|
|
|
91
91
|
{% if importer.import_warnings %}
|
|
92
92
|
<fieldset class="module spreadsheet-module">
|
|
93
93
|
<h2>{% translate "Warnings" %}</h2>
|
|
94
|
-
<ul class="spreadsheet-nested-
|
|
94
|
+
<ul class="spreadsheet-nested-warnings">
|
|
95
95
|
{% regroup importer.import_warnings by sheet_name as warnings_by_sheet %}
|
|
96
96
|
{% for sheet in warnings_by_sheet %}
|
|
97
97
|
<li class="spreadsheet-sheet-item">
|
|
98
98
|
<details>
|
|
99
99
|
{% if sheet.grouper %}
|
|
100
|
-
<summary>{% translate "Sheet" %} "{{ sheet.grouper }}"</summary>
|
|
100
|
+
<summary>{% translate "Sheet" %} "{{ sheet.grouper }}" <span class="detail-link">{% translate "see details" %}</span></summary>
|
|
101
101
|
{% else %}
|
|
102
|
-
<summary>{% translate "General" %}</summary>
|
|
102
|
+
<summary>{% translate "General" %} <span class="detail-link">{% translate "see details" %}</span></summary>
|
|
103
103
|
{% endif %}
|
|
104
104
|
<ul>
|
|
105
105
|
{% regroup sheet.list by title as warnings_by_title %}
|
|
106
106
|
{% for title in warnings_by_title %}
|
|
107
|
-
<li class="spreadsheet-
|
|
107
|
+
<li class="spreadsheet-warning-item">
|
|
108
108
|
<details>
|
|
109
109
|
<summary>
|
|
110
|
-
{{ title.grouper }} <span class="spreadsheet-
|
|
110
|
+
{{ title.grouper }} <span class="detail-link">{% translate "see details" %}</span> <span class="spreadsheet-warning-count">{% blocktranslate count counter=title.list|length %}{{ counter }} warning{% plural %}{{ counter }} warnings{% endblocktranslate %}</span>
|
|
111
111
|
</summary>
|
|
112
|
-
<ul class="spreadsheet-
|
|
112
|
+
<ul class="spreadsheet-warnings-list">
|
|
113
113
|
{% for warning in title.list %}
|
|
114
114
|
<li>{{ warning }}</li>
|
|
115
115
|
{% endfor %}
|
|
@@ -65,9 +65,6 @@ class ValidationMixin:
|
|
|
65
65
|
# items must not contain `,` as it is the official list's items delimiter
|
|
66
66
|
return item.replace(",", self.config.validation_list_replacement_delimiter)
|
|
67
67
|
|
|
68
|
-
if callable(choices):
|
|
69
|
-
choices = choices()
|
|
70
|
-
|
|
71
68
|
prepared_choices = ",".join(
|
|
72
69
|
format_validation_list_item(element)
|
|
73
70
|
for element in choices
|
|
@@ -127,9 +124,6 @@ class ValidationMixin:
|
|
|
127
124
|
"""
|
|
128
125
|
range = validation_config["choices"]
|
|
129
126
|
|
|
130
|
-
if callable(range):
|
|
131
|
-
range = range()
|
|
132
|
-
|
|
133
127
|
return DataValidation(
|
|
134
128
|
type="list",
|
|
135
129
|
formula1=range,
|
|
@@ -142,12 +136,7 @@ class ValidationMixin:
|
|
|
142
136
|
|
|
143
137
|
def setup_type_validation(self, validation_config):
|
|
144
138
|
formula1 = validation_config.get("formula1")
|
|
145
|
-
if callable(formula1):
|
|
146
|
-
formula1 = formula1()
|
|
147
|
-
|
|
148
139
|
formula2 = validation_config.get("formula2")
|
|
149
|
-
if callable(formula2):
|
|
150
|
-
formula2 = formula2()
|
|
151
140
|
|
|
152
141
|
return DataValidation(
|
|
153
142
|
type=validation_config.get("type"),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "django_spreadsheets"
|
|
3
|
-
version = "1.4.
|
|
3
|
+
version = "1.4.2"
|
|
4
4
|
description = "Import from and export to XLSX files with data validation."
|
|
5
5
|
authors = ["Kapt dev team <dev@kapt.mobi>"]
|
|
6
6
|
license = "BSD-3-Clause"
|
|
@@ -22,10 +22,10 @@ bumpversion = "^0.6.0"
|
|
|
22
22
|
black = "~21.9b0"
|
|
23
23
|
flake8 = "~3.9.2"
|
|
24
24
|
isort = "~5.9.3"
|
|
25
|
-
djhtml = "~1.4.
|
|
25
|
+
djhtml = "~1.4.20"
|
|
26
26
|
|
|
27
27
|
[build-system]
|
|
28
|
-
requires = ["poetry-core>=1.4.
|
|
28
|
+
requires = ["poetry-core>=1.4.2", "setuptools"]
|
|
29
29
|
build-backend = "poetry.core.masonry.api"
|
|
30
30
|
|
|
31
31
|
[tool.isort]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.4.0"
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/conf/__init__.py
RENAMED
|
File without changes
|
{django_spreadsheets-1.4.0 → django_spreadsheets-1.4.2}/django_spreadsheets/conf/settings.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|