educommon 3.12.0__py3-none-any.whl → 3.13.2__py3-none-any.whl
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.
- educommon/__init__.py +0 -1
- educommon/about/ui/actions.py +16 -30
- educommon/about/ui/ui.py +3 -12
- educommon/about/utils.py +6 -5
- educommon/async_task/__init__.py +0 -1
- educommon/async_task/actions.py +18 -13
- educommon/async_task/apps.py +4 -0
- educommon/async_task/locker.py +2 -5
- educommon/async_task/migrations/0001_initial.py +55 -9
- educommon/async_task/migrations/0002_task_type_and_status_data.py +94 -89
- educommon/async_task/migrations/0003_alter_runningtask_options.py +0 -1
- educommon/async_task/models.py +9 -6
- educommon/async_task/tasks.py +11 -7
- educommon/async_task/ui.py +16 -35
- educommon/async_tasks/__init__.py +0 -1
- educommon/async_tasks/apps.py +4 -0
- educommon/async_tasks/locks.py +11 -21
- educommon/async_tasks/migrations/0001_initial.py +68 -8
- educommon/async_tasks/migrations/0002_load_initial_data.py +0 -1
- educommon/async_tasks/models.py +9 -29
- educommon/async_tasks/tasks.py +25 -54
- educommon/audit_log/__init__.py +1 -0
- educommon/audit_log/actions.py +27 -36
- educommon/audit_log/app_meta.py +7 -4
- educommon/audit_log/apps.py +44 -29
- educommon/audit_log/constants.py +7 -4
- educommon/audit_log/error_log/actions.py +1 -3
- educommon/audit_log/helpers.py +2 -4
- educommon/audit_log/management/commands/reinstall_audit_log.py +11 -7
- educommon/audit_log/migrations/0001_initial.py +91 -16
- educommon/audit_log/migrations/0002_install_audit_log.py +13 -13
- educommon/audit_log/migrations/0003_logproxy.py +1 -3
- educommon/audit_log/migrations/0004_reinstall_audit_log.py +1 -4
- educommon/audit_log/migrations/0005_postgresql_error.py +4 -2
- educommon/audit_log/migrations/0006_auto_20200806_1707.py +3 -4
- educommon/audit_log/migrations/0007_create_selective_tables_function.py +8 -5
- educommon/audit_log/migrations/0008_table_logged.py +0 -1
- educommon/audit_log/migrations/0009_reinstall_audit_log.py +0 -1
- educommon/audit_log/models.py +36 -42
- educommon/audit_log/permissions.py +11 -9
- educommon/audit_log/proxies.py +12 -23
- educommon/audit_log/ui.py +18 -15
- educommon/audit_log/utils/__init__.py +28 -60
- educommon/audit_log/utils/operations.py +16 -2
- educommon/auth/__init__.py +0 -3
- educommon/auth/rbac/__init__.py +2 -4
- educommon/auth/rbac/actions.py +148 -145
- educommon/auth/rbac/app_meta.py +9 -6
- educommon/auth/rbac/backends/base.py +2 -8
- educommon/auth/rbac/backends/caching.py +27 -37
- educommon/auth/rbac/backends/simple.py +1 -4
- educommon/auth/rbac/checker.py +1 -3
- educommon/auth/rbac/management/commands/rbac.py +6 -11
- educommon/auth/rbac/manager.py +18 -47
- educommon/auth/rbac/migrations/0001_initial.py +73 -12
- educommon/auth/rbac/migrations/0002_model_modifier_metaclass_fix.py +7 -6
- educommon/auth/rbac/migrations/0003_permission_hidden.py +1 -5
- educommon/auth/rbac/migrations/0004_auto_20171024_1245.py +26 -19
- educommon/auth/rbac/models.py +63 -68
- educommon/auth/rbac/permissions.py +6 -7
- educommon/auth/rbac/ui.py +83 -84
- educommon/auth/rbac/utils.py +10 -11
- educommon/auth/rbac/validators.py +4 -5
- educommon/auth/simple_auth/__init__.py +1 -5
- educommon/auth/simple_auth/actions.py +79 -92
- educommon/auth/simple_auth/app_meta.py +2 -9
- educommon/auth/simple_auth/checkers.py +3 -3
- educommon/auth/simple_auth/migrations/0001_initial.py +23 -4
- educommon/auth/simple_auth/validators.py +0 -1
- educommon/contingent/actions.py +7 -7
- educommon/contingent/app_meta.py +1 -4
- educommon/contingent/base.py +10 -15
- educommon/contingent/catalogs.py +424 -540
- educommon/contingent/contingent_plugin/actions.py +4 -15
- educommon/contingent/contingent_plugin/apps.py +10 -4
- educommon/contingent/contingent_plugin/migrations/0001_initial.py +5 -6
- educommon/contingent/contingent_plugin/migrations/0002_add_contingent_model_deleted.py +6 -11
- educommon/contingent/contingent_plugin/model_views.py +2 -12
- educommon/contingent/contingent_plugin/models.py +2 -7
- educommon/contingent/contingent_plugin/observer.py +14 -13
- educommon/contingent/contingent_plugin/plugin_meta.py +1 -3
- educommon/contingent/contingent_plugin/storage.py +8 -7
- educommon/contingent/contingent_plugin/utils.py +6 -6
- educommon/django/db/fields.py +72 -86
- educommon/django/db/migration/__init__.py +3 -7
- educommon/django/db/migration/operations.py +29 -51
- educommon/django/db/mixins/__init__.py +16 -10
- educommon/django/db/mixins/date_interval.py +47 -75
- educommon/django/db/mixins/validation.py +26 -26
- educommon/django/db/model_view/__init__.py +18 -22
- educommon/django/db/models.py +9 -8
- educommon/django/db/observer.py +9 -27
- educommon/django/db/partitioning/__init__.py +66 -92
- educommon/django/db/partitioning/management/commands/apply_partitioning.py +3 -13
- educommon/django/db/partitioning/management/commands/clear_table.py +18 -14
- educommon/django/db/partitioning/management/commands/split_table.py +18 -13
- educommon/django/db/routers.py +6 -15
- educommon/django/db/signals.py +149 -2
- educommon/django/db/utils.py +14 -19
- educommon/django/db/validators/__init__.py +1 -0
- educommon/django/db/validators/simple.py +72 -100
- educommon/django/storages/atcfs/api.py +39 -53
- educommon/django/storages/atcfs/app_meta.py +1 -1
- educommon/django/storages/atcfs/management/commands/atcfs_migrate.py +42 -55
- educommon/django/storages/atcfs/models.py +0 -3
- educommon/django/storages/atcfs/monkey_patching.py +18 -12
- educommon/django/storages/atcfs/storage.py +14 -23
- educommon/extjs/fields/input_params.py +15 -45
- educommon/importer/XLSReader.py +143 -241
- educommon/importer/__init__.py +86 -4
- educommon/importer/api.py +53 -84
- educommon/importer/constants.py +4 -14
- educommon/importer/loggers.py +16 -26
- educommon/importer/proxy.py +131 -176
- educommon/importer/proxy_import.py +11 -12
- educommon/importer/report.py +4 -6
- educommon/importer/ui.py +32 -26
- educommon/importer/validators.py +4 -7
- educommon/integration_entities/helpers.py +14 -18
- educommon/ioc/__init__.py +3 -6
- educommon/logger/loggers.py +10 -14
- educommon/m3/__init__.py +20 -38
- educommon/m3/extensions/__init__.py +1 -0
- educommon/m3/extensions/listeners/__init__.py +22 -38
- educommon/m3/extensions/listeners/delete_check/listeners.py +31 -41
- educommon/m3/extensions/listeners/delete_check/mixins.py +20 -25
- educommon/m3/extensions/listeners/delete_check/signals.py +2 -2
- educommon/m3/extensions/listeners/delete_check/ui.py +15 -14
- educommon/m3/extensions/listeners/delete_check/utils.py +9 -11
- educommon/m3/extensions/ui.py +15 -33
- educommon/m3/transaction_context.py +17 -19
- educommon/objectpack/actions.py +70 -88
- educommon/objectpack/apps.py +5 -0
- educommon/objectpack/filters.py +9 -15
- educommon/objectpack/ui.py +59 -77
- educommon/report/__init__.py +9 -5
- educommon/report/actions.py +29 -32
- educommon/report/constructor/__init__.py +5 -8
- educommon/report/constructor/app_meta.py +1 -3
- educommon/report/constructor/apps.py +1 -0
- educommon/report/constructor/base.py +33 -80
- educommon/report/constructor/builders/excel/_base.py +138 -286
- educommon/report/constructor/builders/excel/_header.py +2 -9
- educommon/report/constructor/builders/excel/product.py +13 -34
- educommon/report/constructor/builders/excel/with_merged_cells.py +18 -14
- educommon/report/constructor/config.py +2 -0
- educommon/report/constructor/editor/actions.py +101 -215
- educommon/report/constructor/editor/ui.py +71 -93
- educommon/report/constructor/exceptions.py +6 -12
- educommon/report/constructor/migrations/0001_initial.py +36 -44
- educommon/report/constructor/migrations/0002_report_filters.py +86 -72
- educommon/report/constructor/migrations/0003_reportfilter_exclude.py +5 -5
- educommon/report/constructor/migrations/0004_reportfilter_fields.py +22 -18
- educommon/report/constructor/migrations/0005_reportcolumn_visible.py +5 -4
- educommon/report/constructor/migrations/0006_reportsorting.py +21 -17
- educommon/report/constructor/migrations/0007_include_available_units.py +14 -14
- educommon/report/constructor/migrations/0008_auto_20170407_1318.py +4 -5
- educommon/report/constructor/migrations/0009_auto_20180405_0642.py +1 -4
- educommon/report/constructor/migrations/0010_add_aggregate_fields.py +7 -8
- educommon/report/constructor/mixins.py +14 -15
- educommon/report/constructor/models.py +76 -124
- educommon/report/constructor/utils.py +3 -8
- educommon/report/constructor/validators.py +1 -3
- educommon/report/reporter.py +25 -43
- educommon/report/utils.py +14 -40
- educommon/rest/actions.py +7 -11
- educommon/rest/context.py +6 -16
- educommon/rest/controllers.py +10 -10
- educommon/rest/mixins.py +29 -27
- educommon/secure_media/app_meta.py +9 -9
- educommon/utils/__init__.py +3 -2
- educommon/utils/caching.py +1 -3
- educommon/utils/conversion.py +1 -3
- educommon/utils/crypto.py +1 -2
- educommon/utils/date.py +13 -26
- educommon/utils/db/__init__.py +17 -26
- educommon/utils/db/postgresql.py +1 -4
- educommon/utils/fonts/__init__.py +3 -4
- educommon/utils/licence/__init__.py +5 -16
- educommon/utils/misc.py +9 -18
- educommon/utils/object_grid.py +55 -62
- educommon/utils/phone_number/modelfields.py +1 -3
- educommon/utils/phone_number/phone_number.py +5 -8
- educommon/utils/phone_number/validators.py +8 -23
- educommon/utils/plugins.py +15 -28
- educommon/utils/registry.py +2 -1
- educommon/utils/seqtools.py +1 -3
- educommon/utils/serializer.py +9 -16
- educommon/utils/storage.py +3 -2
- educommon/utils/system.py +1 -3
- educommon/utils/system_app/management/commands/delete_objects.py +17 -34
- educommon/utils/ui.py +87 -84
- educommon/utils/xml/__init__.py +2 -7
- educommon/utils/xml/resolver.py +1 -0
- educommon/ws_log/actions.py +31 -76
- educommon/ws_log/base.py +6 -20
- educommon/ws_log/migrations/0001_initial.py +25 -8
- educommon/ws_log/migrations/0002_auto_20160628_1334.py +0 -1
- educommon/ws_log/migrations/0003_add_fields_to_smev_logs.py +20 -4
- educommon/ws_log/migrations/0004_auto_20160727_1600.py +7 -6
- educommon/ws_log/migrations/0005_auto_20161130_1615.py +14 -4
- educommon/ws_log/migrations/0006_auto_20170327_1027.py +3 -2
- educommon/ws_log/migrations/0007_auto_20180607_1040.py +8 -9
- educommon/ws_log/migrations/0008_auto_20180713_1445.py +23 -10
- educommon/ws_log/migrations/0009_auto_20201130_1553.py +7 -2
- educommon/ws_log/models.py +21 -35
- educommon/ws_log/provider.py +2 -1
- educommon/ws_log/report.py +8 -13
- educommon/ws_log/smev/applications.py +12 -27
- educommon/ws_log/smev/exceptions.py +2 -3
- educommon/ws_log/ui.py +32 -32
- educommon/ws_log/utils.py +1 -3
- educommon-3.13.2.dist-info/METADATA +57 -0
- educommon-3.13.2.dist-info/RECORD +354 -0
- {educommon-3.12.0.dist-info → educommon-3.13.2.dist-info}/WHEEL +1 -1
- educommon/utils/patches.py +0 -27
- educommon/version.conf +0 -11
- educommon-3.12.0.dist-info/METADATA +0 -47
- educommon-3.12.0.dist-info/RECORD +0 -357
- educommon-3.12.0.dist-info/dependency_links.txt +0 -1
- {educommon-3.12.0.dist-info → educommon-3.13.2.dist-info}/top_level.txt +0 -0
@@ -31,11 +31,7 @@ class HierarchicalHeaderMixin:
|
|
31
31
|
def get_row_count(root_descriptors):
|
32
32
|
# Возвращает количество строк, занимаемое заголовком.
|
33
33
|
return max(
|
34
|
-
(
|
35
|
-
1 + get_row_count(descriptor.children)
|
36
|
-
if descriptor.children
|
37
|
-
else 1
|
38
|
-
)
|
34
|
+
(1 + get_row_count(descriptor.children) if descriptor.children else 1)
|
39
35
|
for descriptor in root_descriptors
|
40
36
|
)
|
41
37
|
|
@@ -67,10 +63,7 @@ class HierarchicalHeaderMixin:
|
|
67
63
|
|
68
64
|
def set_column_count(descriptor):
|
69
65
|
if descriptor.children:
|
70
|
-
descriptor.width = sum(
|
71
|
-
set_column_count(child)
|
72
|
-
for child in descriptor.children
|
73
|
-
)
|
66
|
+
descriptor.width = sum(set_column_count(child) for child in descriptor.children)
|
74
67
|
else:
|
75
68
|
descriptor.width = 1
|
76
69
|
|
@@ -24,8 +24,10 @@ from educommon.utils.misc import (
|
|
24
24
|
|
25
25
|
|
26
26
|
class _Cell:
|
27
|
-
|
28
|
-
|
27
|
+
"""Класс для хранения значения ячейки отчета и порядкового номера ячейки.
|
28
|
+
|
29
|
+
Позволяет сортировать ячейки в соответстии с их порядковым номером.
|
30
|
+
"""
|
29
31
|
|
30
32
|
def __init__(self, index, value):
|
31
33
|
self.index = index
|
@@ -39,23 +41,15 @@ def _join(simple_data, block_indexes, block_row_data):
|
|
39
41
|
"""Объединяет данные основной записи и данные строки блока"""
|
40
42
|
|
41
43
|
# Проставление порядковых номеров
|
42
|
-
block_row_data = tuple(
|
43
|
-
_Cell(index, data)
|
44
|
-
for index, data in zip(block_indexes, block_row_data)
|
45
|
-
)
|
44
|
+
block_row_data = tuple(_Cell(index, data) for index, data in zip(block_indexes, block_row_data))
|
46
45
|
|
47
46
|
# Объединение данных блока и данных записи + упорядочивание.
|
48
47
|
block_row_data = sorted(simple_data + block_row_data)
|
49
48
|
|
50
49
|
# Преобразование данных в "плоский" кортеж (удаление вложенных кортежей).
|
51
|
-
return tuple(
|
52
|
-
(
|
53
|
-
|
54
|
-
if isinstance(cell.value, (tuple, list))
|
55
|
-
else (cell.value,)
|
56
|
-
)
|
57
|
-
for cell in block_row_data
|
58
|
-
)))
|
50
|
+
return tuple(
|
51
|
+
chain(*((cell.value if isinstance(cell.value, (tuple, list)) else (cell.value,)) for cell in block_row_data))
|
52
|
+
)
|
59
53
|
|
60
54
|
|
61
55
|
class ReportBuilder(HierarchicalHeaderMixin, ReportBuilderBase):
|
@@ -92,19 +86,13 @@ class ReportBuilder(HierarchicalHeaderMixin, ReportBuilderBase):
|
|
92
86
|
записи. Результат возвращается в виде блока записей.
|
93
87
|
"""
|
94
88
|
if is_block(data):
|
95
|
-
return tuple(chain(*(
|
96
|
-
ReportBuilder._data_to_rows(row)
|
97
|
-
for row in data
|
98
|
-
)))
|
89
|
+
return tuple(chain(*(ReportBuilder._data_to_rows(row) for row in data)))
|
99
90
|
|
100
91
|
else:
|
101
92
|
# Все вложенные блоки записи нужно преобразовать к плоской
|
102
93
|
# структуре, чтобы они содержали только данные (без вложенных
|
103
94
|
# блоков). Т.е. в итоге не должно быть многоуровневой вложенности.
|
104
|
-
data = tuple(
|
105
|
-
ReportBuilder._data_to_rows(cell) if is_block(cell) else cell
|
106
|
-
for cell in data
|
107
|
-
)
|
95
|
+
data = tuple(ReportBuilder._data_to_rows(cell) if is_block(cell) else cell for cell in data)
|
108
96
|
|
109
97
|
# После того, как избавились от вложенных блоков, нужно вычислить
|
110
98
|
# декартово произведение данной записи и вложенных в неё блоков.
|
@@ -117,15 +105,8 @@ class ReportBuilder(HierarchicalHeaderMixin, ReportBuilderBase):
|
|
117
105
|
store = block_indexes if is_block(cell) else simple_indexes
|
118
106
|
store.append(index)
|
119
107
|
|
120
|
-
simple_data = tuple(
|
121
|
-
|
122
|
-
for index in simple_indexes
|
123
|
-
)
|
124
|
-
blocks_data = product(*(
|
125
|
-
cell_data
|
126
|
-
for cell_data in data
|
127
|
-
if is_block(cell_data)
|
128
|
-
))
|
108
|
+
simple_data = tuple(_Cell(index, data[index]) for index in simple_indexes)
|
109
|
+
blocks_data = product(*(cell_data for cell_data in data if is_block(cell_data)))
|
129
110
|
|
130
111
|
join = partial(_join, simple_data, block_indexes)
|
131
112
|
return tuple(map(join, blocks_data))
|
@@ -140,6 +121,4 @@ class ReportBuilder(HierarchicalHeaderMixin, ReportBuilderBase):
|
|
140
121
|
else:
|
141
122
|
style = self._data_cell_style
|
142
123
|
|
143
|
-
self._worksheet.write(
|
144
|
-
row_number, column_number, cell_data, style
|
145
|
-
)
|
124
|
+
self._worksheet.write(row_number, column_number, cell_data, style)
|
@@ -1,4 +1,5 @@
|
|
1
|
-
"""Реализация построителя
|
1
|
+
"""Реализация построителя отчетов."""
|
2
|
+
|
2
3
|
from datetime import (
|
3
4
|
date,
|
4
5
|
datetime,
|
@@ -17,7 +18,6 @@ from educommon.utils.misc import (
|
|
17
18
|
|
18
19
|
|
19
20
|
class Frame:
|
20
|
-
|
21
21
|
def __init__(self, worksheet, top, left, style):
|
22
22
|
self._worksheet = worksheet
|
23
23
|
self._top = top
|
@@ -32,13 +32,16 @@ class Frame:
|
|
32
32
|
|
33
33
|
@property
|
34
34
|
def written_rows(self):
|
35
|
+
"""Количество строк, записанных в текущей области."""
|
35
36
|
return self._written_rows
|
36
37
|
|
37
38
|
@property
|
38
39
|
def written_columns(self):
|
40
|
+
"""Количество колонок, записанных в текущей области."""
|
39
41
|
return self._written_columns
|
40
42
|
|
41
43
|
def _nested_frame(self):
|
44
|
+
"""Создаёт вложенную область отчёта относительно текущей позиции."""
|
42
45
|
return Frame(
|
43
46
|
worksheet=self._worksheet,
|
44
47
|
top=self._top + self._current_row,
|
@@ -47,10 +50,12 @@ class Frame:
|
|
47
50
|
)
|
48
51
|
|
49
52
|
def new_row(self):
|
53
|
+
"""Переходит к следующей строке отчёта."""
|
50
54
|
self._current_row = self._top + self._written_rows
|
51
55
|
self._current_column = self._left
|
52
56
|
|
53
57
|
def _write_cell(self, cell_data, height):
|
58
|
+
"""Записывает одну ячейку с возможным объединением по вертикали."""
|
54
59
|
assert height > 0, height
|
55
60
|
|
56
61
|
if isinstance(cell_data, (date, time, datetime)):
|
@@ -61,18 +66,20 @@ class Frame:
|
|
61
66
|
top = self._top + self._current_row
|
62
67
|
left = self._left + self._current_column
|
63
68
|
if height > 1:
|
64
|
-
self._worksheet.merge_range(
|
65
|
-
top, left, top + height - 1, left, cell_data, style
|
66
|
-
)
|
69
|
+
self._worksheet.merge_range(top, left, top + height - 1, left, cell_data, style)
|
67
70
|
else:
|
68
71
|
self._worksheet.write(
|
69
|
-
top,
|
72
|
+
top,
|
73
|
+
left,
|
74
|
+
cell_data,
|
75
|
+
style,
|
70
76
|
)
|
71
77
|
self._written_rows = max(height, self._written_rows)
|
72
78
|
self._current_column += 1
|
73
79
|
self._written_columns += 1
|
74
80
|
|
75
81
|
def _write_block(self, data, row_height=None):
|
82
|
+
"""Записывает блок строк (вложенных списков) в область отчёта."""
|
76
83
|
block_rows = block_columns = 0
|
77
84
|
|
78
85
|
for row_data in data:
|
@@ -106,25 +113,21 @@ class Frame:
|
|
106
113
|
|
107
114
|
@staticmethod
|
108
115
|
def _get_row_height(record_data):
|
116
|
+
"""Определяет высоту строки с учётом вложенных данных."""
|
109
117
|
# Возвращает количество строк, занимаемое записью (с учетом вложенных
|
110
118
|
# блоков).
|
111
119
|
|
112
120
|
def get_row_height(cell_data):
|
113
121
|
# Возвращает количество строк, которое необходимо
|
114
122
|
if isinstance(cell_data, list):
|
115
|
-
return max(1, sum(
|
116
|
-
get_row_height(data)
|
117
|
-
for data in cell_data
|
118
|
-
if isinstance(data, list)
|
119
|
-
))
|
123
|
+
return max(1, sum(get_row_height(data) for data in cell_data if isinstance(data, list)))
|
120
124
|
else:
|
121
125
|
return 1
|
122
126
|
|
123
|
-
return max(
|
124
|
-
map(get_row_height, record_data)
|
125
|
-
)
|
127
|
+
return max(map(get_row_height, record_data))
|
126
128
|
|
127
129
|
def _write_row(self, data):
|
130
|
+
"""Записывает одну логическую строку, содержащую ячейки и/или вложенные блоки."""
|
128
131
|
row_height = self._get_row_height(data)
|
129
132
|
|
130
133
|
for cell_data in data:
|
@@ -134,6 +137,7 @@ class Frame:
|
|
134
137
|
self._write_cell(cell_data, row_height)
|
135
138
|
|
136
139
|
def write(self, data):
|
140
|
+
"""Записывает данные в область отчёта: строку, блок или одну ячейку."""
|
137
141
|
if all(isinstance(d, list) for d in data):
|
138
142
|
self._write_block(data)
|
139
143
|
elif isinstance(data, list):
|
@@ -1,4 +1,5 @@
|
|
1
1
|
"""Конфигурация асинхронной сборки отчета."""
|
2
|
+
|
2
3
|
from abc import (
|
3
4
|
ABCMeta,
|
4
5
|
abstractmethod,
|
@@ -15,6 +16,7 @@ class ConstructorConfig(metaclass=ABCMeta):
|
|
15
16
|
|
16
17
|
:rtype: :class:`celery.app.task.Task`
|
17
18
|
"""
|
19
|
+
|
18
20
|
@property
|
19
21
|
@abstractmethod
|
20
22
|
def current_user_func(self):
|