arpakitlib 1.7.201__py3-none-any.whl → 1.7.203__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.
- arpakitlib/_arpakit_project_template/src/admin1/add_admin_in_app.py +2 -2
- arpakitlib/_arpakit_project_template/src/admin1/model_view.py +0 -18
- arpakitlib/ar_class_util.py +2 -2
- arpakitlib/ar_sqladmin_util.py +101 -0
- {arpakitlib-1.7.201.dist-info → arpakitlib-1.7.203.dist-info}/METADATA +1 -1
- {arpakitlib-1.7.201.dist-info → arpakitlib-1.7.203.dist-info}/RECORD +9 -8
- {arpakitlib-1.7.201.dist-info → arpakitlib-1.7.203.dist-info}/LICENSE +0 -0
- {arpakitlib-1.7.201.dist-info → arpakitlib-1.7.203.dist-info}/WHEEL +0 -0
- {arpakitlib-1.7.201.dist-info → arpakitlib-1.7.203.dist-info}/entry_points.txt +0 -0
@@ -1,8 +1,8 @@
|
|
1
1
|
from fastapi import FastAPI
|
2
2
|
from sqladmin import Admin
|
3
3
|
|
4
|
+
from arpakitlib.ar_sqladmin_util import SimpleModelView
|
4
5
|
from src.admin1.admin_auth import AdminAuth
|
5
|
-
from src.admin1.model_view import MODEL_VIEWS
|
6
6
|
from src.api.transmitted_api_data import TransmittedAPIData
|
7
7
|
from src.core.settings import get_cached_settings
|
8
8
|
|
@@ -20,7 +20,7 @@ def add_admin1_in_app(*, app: FastAPI) -> FastAPI:
|
|
20
20
|
title=get_cached_settings().project_name
|
21
21
|
)
|
22
22
|
|
23
|
-
for model_view in
|
23
|
+
for model_view in SimpleModelView.all_subclasses:
|
24
24
|
admin.add_model_view(model_view)
|
25
25
|
|
26
26
|
return app
|
@@ -1,19 +1 @@
|
|
1
|
-
from sqladmin import ModelView
|
2
|
-
|
3
|
-
|
4
|
-
class BaseModelView(ModelView):
|
5
|
-
can_create = True
|
6
|
-
can_edit = True
|
7
|
-
can_delete = True
|
8
|
-
can_view_details = True
|
9
|
-
can_export = True
|
10
|
-
page_size = 50
|
11
|
-
page_size_options = [25, 50, 100, 200]
|
12
|
-
save_as = True
|
13
|
-
save_as_continue = True
|
14
|
-
export_types = ["xlsx", "csv", "json"]
|
15
|
-
|
16
|
-
|
17
|
-
MODEL_VIEWS = []
|
18
|
-
|
19
1
|
# ...
|
arpakitlib/ar_class_util.py
CHANGED
@@ -9,8 +9,8 @@ class CollectingSubclassesMeta(type):
|
|
9
9
|
Метакласс для автоматического сбора всех наследников в поле ALL_SUBCLASSES.
|
10
10
|
"""
|
11
11
|
|
12
|
-
def __init__(cls, name, bases, dct):
|
13
|
-
super().__init__(name, bases, dct)
|
12
|
+
def __init__(cls, name, bases, dct, **kwargs):
|
13
|
+
super().__init__(name, bases, dct, **kwargs)
|
14
14
|
if not hasattr(cls, "all_subclasses"):
|
15
15
|
cls.all_subclasses = []
|
16
16
|
elif bases:
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# arpakit
|
2
|
+
from sqladmin import ModelView
|
3
|
+
from sqladmin.models import ModelViewMeta
|
4
|
+
|
5
|
+
from arpakitlib.ar_class_util import CollectingSubclassesMeta
|
6
|
+
from arpakitlib.ar_sqlalchemy_model_util import OperationDBM, StoryLogDBM
|
7
|
+
|
8
|
+
_ARPAKIT_LIB_MODULE_VERSION = "3.0"
|
9
|
+
|
10
|
+
|
11
|
+
def create_combined_meta(*metas):
|
12
|
+
"""
|
13
|
+
Создает объединённый метакласс для устранения конфликтов.
|
14
|
+
"""
|
15
|
+
|
16
|
+
class CombinedMeta(*metas):
|
17
|
+
pass
|
18
|
+
|
19
|
+
return CombinedMeta
|
20
|
+
|
21
|
+
|
22
|
+
class SimpleModelView(ModelView, metaclass=create_combined_meta(CollectingSubclassesMeta, ModelViewMeta)):
|
23
|
+
can_create = True
|
24
|
+
can_edit = True
|
25
|
+
can_delete = True
|
26
|
+
can_view_details = True
|
27
|
+
can_export = True
|
28
|
+
page_size = 50
|
29
|
+
page_size_options = [25, 50, 100, 200]
|
30
|
+
save_as = True
|
31
|
+
save_as_continue = True
|
32
|
+
export_types = ["xlsx", "csv", "json"]
|
33
|
+
|
34
|
+
|
35
|
+
class OperationMV(SimpleModelView, model=OperationDBM):
|
36
|
+
name = "Operation"
|
37
|
+
name_plural = "Operations"
|
38
|
+
column_list = [
|
39
|
+
OperationDBM.id,
|
40
|
+
OperationDBM.long_id,
|
41
|
+
OperationDBM.creation_dt,
|
42
|
+
OperationDBM.status,
|
43
|
+
OperationDBM.type,
|
44
|
+
OperationDBM.execution_start_dt,
|
45
|
+
OperationDBM.execution_finish_dt,
|
46
|
+
OperationDBM.input_data,
|
47
|
+
OperationDBM.output_data,
|
48
|
+
OperationDBM.error_data
|
49
|
+
]
|
50
|
+
form_columns = [
|
51
|
+
OperationDBM.status,
|
52
|
+
OperationDBM.type,
|
53
|
+
OperationDBM.execution_start_dt,
|
54
|
+
OperationDBM.execution_finish_dt,
|
55
|
+
OperationDBM.input_data,
|
56
|
+
OperationDBM.output_data,
|
57
|
+
OperationDBM.error_data
|
58
|
+
]
|
59
|
+
column_default_sort = [(OperationDBM.creation_dt, True)]
|
60
|
+
column_searchable_list = [
|
61
|
+
OperationDBM.id,
|
62
|
+
OperationDBM.long_id,
|
63
|
+
OperationDBM.status,
|
64
|
+
OperationDBM.type,
|
65
|
+
]
|
66
|
+
|
67
|
+
|
68
|
+
class StoryLogMV(SimpleModelView, model=StoryLogDBM):
|
69
|
+
name = "Operation"
|
70
|
+
name_plural = "Operations"
|
71
|
+
column_list = [
|
72
|
+
StoryLogDBM.id,
|
73
|
+
StoryLogDBM.long_id,
|
74
|
+
StoryLogDBM.creation_dt,
|
75
|
+
StoryLogDBM.level,
|
76
|
+
StoryLogDBM.title,
|
77
|
+
StoryLogDBM.data
|
78
|
+
]
|
79
|
+
form_columns = [
|
80
|
+
StoryLogDBM.level,
|
81
|
+
StoryLogDBM.title,
|
82
|
+
StoryLogDBM.data
|
83
|
+
]
|
84
|
+
column_default_sort = [(StoryLogDBM.creation_dt, True)]
|
85
|
+
column_searchable_list = [
|
86
|
+
StoryLogDBM.id,
|
87
|
+
StoryLogDBM.long_id,
|
88
|
+
StoryLogDBM.level,
|
89
|
+
StoryLogDBM.title,
|
90
|
+
StoryLogDBM.data
|
91
|
+
]
|
92
|
+
|
93
|
+
|
94
|
+
def __example():
|
95
|
+
print(len(SimpleModelView.all_subclasses))
|
96
|
+
for model_view in SimpleModelView.all_subclasses:
|
97
|
+
print(model_view)
|
98
|
+
|
99
|
+
|
100
|
+
if __name__ == '__main__':
|
101
|
+
__example()
|
@@ -60,9 +60,9 @@ arpakitlib/_arpakit_project_template/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5
|
|
60
60
|
arpakitlib/_arpakit_project_template/src/additional_model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
61
61
|
arpakitlib/_arpakit_project_template/src/additional_model/additional_model.py,sha256=rCjK4hbog2kF-37SGHet0mrSjGXrAi1LxCgLT1IzzW8,141
|
62
62
|
arpakitlib/_arpakit_project_template/src/admin1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
63
|
-
arpakitlib/_arpakit_project_template/src/admin1/add_admin_in_app.py,sha256=
|
63
|
+
arpakitlib/_arpakit_project_template/src/admin1/add_admin_in_app.py,sha256=NcDav2QnMxK10tuI1X1chz6iTrtgcOylIwWxHmH-7p0,784
|
64
64
|
arpakitlib/_arpakit_project_template/src/admin1/admin_auth.py,sha256=qEC7gMy9E6mwuQRxnSsmVthXahVai4zjiC6Z8O3MZn8,804
|
65
|
-
arpakitlib/_arpakit_project_template/src/admin1/model_view.py,sha256=
|
65
|
+
arpakitlib/_arpakit_project_template/src/admin1/model_view.py,sha256=dcvj5C9E2F2KCsGZPBBncQf_EvVJAC1qQgnyD8P4ZEw,6
|
66
66
|
arpakitlib/_arpakit_project_template/src/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
67
67
|
arpakitlib/_arpakit_project_template/src/api/_start_api_with_reload.py,sha256=3IjlhcleK2JoG-rYDHxVKpJA8uq4dTW_-_lbgPXsufI,333
|
68
68
|
arpakitlib/_arpakit_project_template/src/api/_start_api_without_reload.py,sha256=SRU3vahgxvVAzb8nIRDspXusK8_SS5QGblJE824Y12s,340
|
@@ -125,7 +125,7 @@ arpakitlib/ar_arpakitlib_cli_util.py,sha256=8lhEDxnwMSRX2PGV2xQtQru1AYKSA92SVolo
|
|
125
125
|
arpakitlib/ar_base64_util.py,sha256=aZkg2cZTuAaP2IWeG_LXJ6RO7qhyskVwec-Lks0iM-k,676
|
126
126
|
arpakitlib/ar_base_worker_util.py,sha256=Qm_C7PFH5W-LPu1AGX1zp29zbqZ04i71Su1U-eeQBkA,5674
|
127
127
|
arpakitlib/ar_cache_file_util.py,sha256=Fo2pH-Zqm966KWFBHG_pbiySGZvhIFCYqy7k1weRfJ0,3476
|
128
|
-
arpakitlib/ar_class_util.py,sha256=
|
128
|
+
arpakitlib/ar_class_util.py,sha256=Eb4orGm2EFSaHfmrY2A_Nis5iwFMDKFaz1_nxTnfmnQ,487
|
129
129
|
arpakitlib/ar_datetime_util.py,sha256=Xe1NiT9oPQzNSG7RVRkhukhbg4i-hhS5ImmV7sPUc8o,971
|
130
130
|
arpakitlib/ar_dict_util.py,sha256=cF5LQJ6tLqyGoEXfDljMDZrikeZoWPw7CgINHIFGvXM,419
|
131
131
|
arpakitlib/ar_dream_ai_api_client_util.py,sha256=QF9XK7xK5ny1fvkcG4e0pfCySNNFRNPy0x0cmxfsAak,2818
|
@@ -175,6 +175,7 @@ arpakitlib/ar_run_cmd_util.py,sha256=D_rPavKMmWkQtwvZFz-Io5Ak8eSODHkcFeLPzNVC68g
|
|
175
175
|
arpakitlib/ar_schedule_uust_api_client_util.py,sha256=0Ns0mMEXYEkVmP6YTAXHyNcrhNsvCJ8X-G_5XwILhJ4,6855
|
176
176
|
arpakitlib/ar_settings_util.py,sha256=752EDXXnrA1uUbSD4InCHCZWEodLBwVUHrgOdOD2Xhw,1856
|
177
177
|
arpakitlib/ar_sleep_util.py,sha256=OaLtRaJQWMkGjfj_mW1RB2P4RaSWsAIH8LUoXqsH0zM,1061
|
178
|
+
arpakitlib/ar_sqladmin_util.py,sha256=vQTRlf36VjW6l_zslZmjkHinMVuQfI-QZsXIlnXUpgE,2634
|
178
179
|
arpakitlib/ar_sqlalchemy_model_util.py,sha256=nKJGN32eg3Gn5kmJwHdVJznPT5TydLsfUfwJGdypdUo,6264
|
179
180
|
arpakitlib/ar_sqlalchemy_util.py,sha256=Hcg1THrDsSR_-8dsY1CG3NWPEv0FqCbkPXFXLtjlSJ0,4207
|
180
181
|
arpakitlib/ar_ssh_runner_util.py,sha256=e9deuUdBW7Eh0Exx2nTBhk57SaOZYaJaSjNk8q6dbJk,6804
|
@@ -182,8 +183,8 @@ arpakitlib/ar_str_util.py,sha256=yU5gOwNXUQaH5b_tM5t6fXUn9oUcv5EQbVnq2wXXIpQ,337
|
|
182
183
|
arpakitlib/ar_type_util.py,sha256=9C3ErtUVs0tAUqtK-foFzjJOykfBOntfCz2IogDOgfA,4134
|
183
184
|
arpakitlib/ar_yookassa_api_client_util.py,sha256=sh4fcUkAkdOetFn9JYoTvjcSXP-M1wU04KEY-ECLfLg,5137
|
184
185
|
arpakitlib/ar_zabbix_api_client_util.py,sha256=Q-VR4MvoZ9aHwZeYZr9G3LwN-ANx1T5KFmF6pvPM-9M,6402
|
185
|
-
arpakitlib-1.7.
|
186
|
-
arpakitlib-1.7.
|
187
|
-
arpakitlib-1.7.
|
188
|
-
arpakitlib-1.7.
|
189
|
-
arpakitlib-1.7.
|
186
|
+
arpakitlib-1.7.203.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
|
187
|
+
arpakitlib-1.7.203.dist-info/METADATA,sha256=DJhWigr5MUGWWHvT8WOtVqQlIrWxoG2BsIhLrSeTSsU,3176
|
188
|
+
arpakitlib-1.7.203.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
189
|
+
arpakitlib-1.7.203.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
|
190
|
+
arpakitlib-1.7.203.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|