brilliance-admin 0.43.6__py3-none-any.whl → 0.44.0__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.
- brilliance_admin/integrations/sqlalchemy/__init__.py +1 -0
- brilliance_admin/integrations/sqlalchemy/autocomplete.py +6 -2
- brilliance_admin/integrations/sqlalchemy/fields.py +7 -5
- brilliance_admin/schema/__init__.py +2 -2
- brilliance_admin/schema/admin_schema.py +21 -19
- brilliance_admin/schema/category.py +86 -11
- brilliance_admin/schema/graphs/category_graphs.py +2 -3
- brilliance_admin/schema/table/category_table.py +4 -2
- brilliance_admin/static/{index-D9axz5zK.js → index-MLuDem5W.js} +131 -131
- brilliance_admin/static/{index-vlBToOhT.css → index-P_wdMBbz.css} +1 -1
- brilliance_admin/templates/index.html +2 -2
- brilliance_admin/utils.py +38 -0
- brilliance_admin-0.44.0.dist-info/METADATA +155 -0
- {brilliance_admin-0.43.6.dist-info → brilliance_admin-0.44.0.dist-info}/RECORD +17 -18
- brilliance_admin-0.44.0.dist-info/licenses/LICENSE +21 -0
- brilliance_admin/schema/group.py +0 -67
- brilliance_admin-0.43.6.dist-info/METADATA +0 -214
- brilliance_admin-0.43.6.dist-info/licenses/LICENSE +0 -17
- {brilliance_admin-0.43.6.dist-info → brilliance_admin-0.44.0.dist-info}/WHEEL +0 -0
- {brilliance_admin-0.43.6.dist-info → brilliance_admin-0.44.0.dist-info}/top_level.txt +0 -0
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
<link rel="icon" href="{{ favicon_image }}" />
|
|
14
14
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
15
15
|
<title>{{ title }}</title>
|
|
16
|
-
<script type="module" crossorigin src="/admin/static/index-
|
|
17
|
-
<link rel="stylesheet" crossorigin href="/admin/static/index-
|
|
16
|
+
<script type="module" crossorigin src="/admin/static/index-MLuDem5W.js"></script>
|
|
17
|
+
<link rel="stylesheet" crossorigin href="/admin/static/index-P_wdMBbz.css">
|
|
18
18
|
</head>
|
|
19
19
|
|
|
20
20
|
<body>
|
brilliance_admin/utils.py
CHANGED
|
@@ -5,6 +5,7 @@ from typing import Any, Dict, Protocol
|
|
|
5
5
|
|
|
6
6
|
import yaml
|
|
7
7
|
from pydantic import TypeAdapter
|
|
8
|
+
from pydantic.fields import FieldInfo
|
|
8
9
|
from pydantic_core import core_schema
|
|
9
10
|
|
|
10
11
|
|
|
@@ -37,6 +38,43 @@ class DeserializeAction:
|
|
|
37
38
|
FILTERS = 3
|
|
38
39
|
|
|
39
40
|
|
|
41
|
+
class KwargsInitMixin:
|
|
42
|
+
"""
|
|
43
|
+
Принимает только аргументы, объявленные в аннотациях.
|
|
44
|
+
Применяет default / default_factory из Field.
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
def __init__(self, **kwargs):
|
|
48
|
+
annotations = {}
|
|
49
|
+
for cls in type(self).__mro__:
|
|
50
|
+
annotations.update(getattr(cls, '__annotations__', {}))
|
|
51
|
+
|
|
52
|
+
allowed = set(annotations.keys())
|
|
53
|
+
|
|
54
|
+
for key, value in kwargs.items():
|
|
55
|
+
if key not in allowed:
|
|
56
|
+
raise AttributeError(
|
|
57
|
+
f'{type(self).__name__} has no field "{key}". '
|
|
58
|
+
f'Allowed fields: {sorted(allowed)}'
|
|
59
|
+
)
|
|
60
|
+
setattr(self, key, value)
|
|
61
|
+
|
|
62
|
+
self._apply_field_defaults()
|
|
63
|
+
|
|
64
|
+
def _apply_field_defaults(self):
|
|
65
|
+
for cls in type(self).__mro__:
|
|
66
|
+
for name, value in cls.__dict__.items():
|
|
67
|
+
if not isinstance(value, FieldInfo):
|
|
68
|
+
continue
|
|
69
|
+
|
|
70
|
+
# если в инстансе всё ещё FieldInfo — заменить
|
|
71
|
+
if getattr(self, name, None) is value:
|
|
72
|
+
if value.default_factory is not None:
|
|
73
|
+
setattr(self, name, value.default_factory())
|
|
74
|
+
elif value.default is not None:
|
|
75
|
+
setattr(self, name, value.default)
|
|
76
|
+
|
|
77
|
+
|
|
40
78
|
class DataclassBase:
|
|
41
79
|
def model_dump(self, *args, **kwargs) -> dict:
|
|
42
80
|
adapter = TypeAdapter(type(self))
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: brilliance-admin
|
|
3
|
+
Version: 0.44.0
|
|
4
|
+
Summary: Simple and lightweight data managment framework powered by FastAPI and Vue3 Vuetify all-in-one. Some call it heavenly in its brilliance.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: asgiref>=3.11
|
|
10
|
+
Requires-Dist: fastapi>=0.115
|
|
11
|
+
Requires-Dist: jinja2>=3.1
|
|
12
|
+
Requires-Dist: PyYAML>=6.0
|
|
13
|
+
Provides-Extra: example
|
|
14
|
+
Requires-Dist: uvicorn>=0.34.0; extra == "example"
|
|
15
|
+
Requires-Dist: faker>=38.2.0; extra == "example"
|
|
16
|
+
Requires-Dist: pyjwt>=2.10.1; extra == "example"
|
|
17
|
+
Requires-Dist: structlog>=25.5.0; extra == "example"
|
|
18
|
+
Requires-Dist: rich>=14.2.0; extra == "example"
|
|
19
|
+
Provides-Extra: tests
|
|
20
|
+
Requires-Dist: pytest>=8.4.2; extra == "tests"
|
|
21
|
+
Requires-Dist: pytest-asyncio>=1.2.0; extra == "tests"
|
|
22
|
+
Requires-Dist: httpx>=0.28.1; extra == "tests"
|
|
23
|
+
Requires-Dist: pytest-mock>=3.15.1; extra == "tests"
|
|
24
|
+
Requires-Dist: sqlalchemy>=2.0.41; extra == "tests"
|
|
25
|
+
Requires-Dist: aiosqlite>=0.22.1; extra == "tests"
|
|
26
|
+
Requires-Dist: factory-boy>=3.3.3; extra == "tests"
|
|
27
|
+
Requires-Dist: pyjwt>=2.10.1; extra == "tests"
|
|
28
|
+
Provides-Extra: scalar
|
|
29
|
+
Requires-Dist: scalar-fastapi>=1.5.0; extra == "scalar"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
<div align="center">
|
|
33
|
+
<img src="https://github.com/brilliance-admin/backend-python/blob/main/example/static/logo-outline.png?raw=true"
|
|
34
|
+
alt="Brilliance Admin"
|
|
35
|
+
width="600">
|
|
36
|
+
|
|
37
|
+
[](https://pypi.org/project/brilliance-admin/)
|
|
38
|
+
[](https://github.com/brilliance-admin/backend-python/actions)
|
|
39
|
+
|
|
40
|
+
Simple and lightweight data managment framework powered by `FastAPI` and `Vue3` `Vuetify` all-in-one. \
|
|
41
|
+
Integrated with `SQLAlchemy`. Inspaired by Django Admin and DRF.\
|
|
42
|
+
_Some call it heavenly in its brilliance._
|
|
43
|
+
|
|
44
|
+
### [Live Demo](https://brilliance-admin.com/) | [Demo Sources](https://github.com/brilliance-admin/backend-python/tree/main/example) | [Documentation](https://docs.brilliance-admin.com/)
|
|
45
|
+
|
|
46
|
+
<img src="https://github.com/brilliance-admin/backend-python/blob/main/screenshots/websitemockupgenerator.png?raw=true"
|
|
47
|
+
alt="Preview">
|
|
48
|
+
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
### Brilliance Admin provides
|
|
52
|
+
|
|
53
|
+
A quick way to create a data management interface using:
|
|
54
|
+
|
|
55
|
+
- Admin page - endpoint with a prebuilt SPA [frontend Vue3 + Vuetify](https://github.com/brilliance-admin/frontend) <br>
|
|
56
|
+
This endpoint can be added to any ASGI compatable backend. For existing project or standalone admin app.
|
|
57
|
+
- API to fetch the UI JSON schema
|
|
58
|
+
- API methods for that UI to work with (to read and modify data)
|
|
59
|
+
|
|
60
|
+
## Key ideas
|
|
61
|
+
|
|
62
|
+
- **API Oriented** <br>
|
|
63
|
+
Data generation/updating API separated from rendering fontend with zero hardcode, this makes it possible to have a single frontend with multiple backend implementations in different languages and makes test coverage easier.
|
|
64
|
+
- **Rich visualization** <br>
|
|
65
|
+
Providing rich and convenient ways to display and manage data (tables, charts, etc) from any data source.
|
|
66
|
+
- **UI JSON Schema** <br>
|
|
67
|
+
Represents the data describing the structure of entire admin panel UI. <br>
|
|
68
|
+
You only need to specify what should be rendered. The frontend will display it and automatically request data from the backend for rendering or updates.
|
|
69
|
+
- **ORM** <br>
|
|
70
|
+
Automatic generation from ORM for schema UI frontend and backend methods for CRUD operations.
|
|
71
|
+
- **Minimal boilerplate** <br>
|
|
72
|
+
Focused on simplified, but rich configuration.
|
|
73
|
+
|
|
74
|
+
## Features
|
|
75
|
+
|
|
76
|
+
* Tables with full CRUD support, including filtering, sorting, and pagination.
|
|
77
|
+
* Ability to define custom table actions with forms, response messages, and file downloads.
|
|
78
|
+
* Graphs via ChartJS
|
|
79
|
+
* Localization support
|
|
80
|
+
* Adapted for different screen sizes and mobile devices
|
|
81
|
+
* Auth via any account data source
|
|
82
|
+
|
|
83
|
+
**Integrations:**
|
|
84
|
+
|
|
85
|
+
* **SQLAlchemy** - schema autogeneration for tables + CRUD operations + authorization
|
|
86
|
+
|
|
87
|
+
**Planned:**
|
|
88
|
+
|
|
89
|
+
* Dashboard features
|
|
90
|
+
* Role-based access permissions system via interface
|
|
91
|
+
* Backend interface for storing and viewing action history in the admin interface
|
|
92
|
+
* Nested data support for creation and detail views (inline editing), nested CRUD workflows
|
|
93
|
+
* Django ORM integration
|
|
94
|
+
* Support for Oauth providers
|
|
95
|
+
|
|
96
|
+
## Installation:
|
|
97
|
+
``` shell
|
|
98
|
+
pip install brilliance-admin
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Usage example
|
|
102
|
+
|
|
103
|
+
You need to generate `AdminSchema` instance:
|
|
104
|
+
``` python
|
|
105
|
+
from brilliance_admin import schema
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
class CategoryExample(schema.CategoryTable):
|
|
109
|
+
"Implementation of get_list and retrieve; update and create are optional"
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
admin_schema = schema.AdminSchema(
|
|
113
|
+
title='Admin Panel',
|
|
114
|
+
auth=YourAdminAuthentication(),
|
|
115
|
+
categories=[
|
|
116
|
+
schema.Category(
|
|
117
|
+
slug='example',
|
|
118
|
+
categories=[
|
|
119
|
+
CategoryExample(),
|
|
120
|
+
]
|
|
121
|
+
),
|
|
122
|
+
],
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
admin_app = admin_schema.generate_app()
|
|
126
|
+
|
|
127
|
+
# Your FastAPI app (Any ASGI framework can be used)
|
|
128
|
+
app = FastAPI()
|
|
129
|
+
app.mount('/admin', admin_app)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
For more details, check out our [how-to-start documentation](https://docs.brilliance-admin.com/how-to-start/)
|
|
133
|
+
|
|
134
|
+
## Comparison of Similar Projects
|
|
135
|
+
|
|
136
|
+
The project closest in concept is [React Admin](https://github.com/marmelab/react-admin). <br>
|
|
137
|
+
It is an SPA frontend that store the schema UI inside and works with separate API backend providers.
|
|
138
|
+
|
|
139
|
+
The key difference of Brilliance Admin is that its all-in-one. <br>
|
|
140
|
+
It is more focused on rapid setup for data management, without the need to work with frontend configuration, while it still available.
|
|
141
|
+
|
|
142
|
+
## Comparison of Similar Python Projects
|
|
143
|
+
|
|
144
|
+
| Criterion | Brilliance Admin | Django Admin | FastAPI Admin | Starlette Admin | SQLAdmin |
|
|
145
|
+
|---------|------------------|--------------|---------------|-----------------|----------|
|
|
146
|
+
| Base framework | FastAPI | Django | FastAPI | Starlette | FastAPI |
|
|
147
|
+
| ASGI compatible | Yes | Partial | Yes | Yes | Yes |
|
|
148
|
+
| Rendering model | Prebuilt Vue 3 + Vuetify SPA + Jinja2 | Server-side Django templates | Server-side Jinja2 templates + Tabler UI | Server-side Jinja2 templates + Tabler UI | Server-side Jinja2 templates + Bootstrap |
|
|
149
|
+
| Frontend architecture | Separate frontend (SPA) | Classic server-rendered UI | Server-rendered UI with JS interactivity | Server-rendered UI with JS interactivity | Server-rendered UI |
|
|
150
|
+
| Data source | Any source + SQLAlchemy | Django ORM | Tortoise ORM | Any source + SQLAlchemy, MongoDB | SQLAlchemy |
|
|
151
|
+
| Multiple databases per model | Yes | Database routers | No (global engine) | Yes (session per ModelView) | No (single engine per Admin) |
|
|
152
|
+
| Schema generation | User-defined format | From Django models | From ORM models | User-defined format | From SQLAlchemy models |
|
|
153
|
+
| Async support | Yes | No | Yes | Yes | Yes |
|
|
154
|
+
| API-first approach | Yes | No | Partially | Partially | No |
|
|
155
|
+
| Built-in Localization | Yes | Yes | No | No | No |
|
|
@@ -3,7 +3,7 @@ brilliance_admin/auth.py,sha256=d57XRfLJIbOosLP1-0SCFkePPT8M5WhLcwxu4yW92RA,673
|
|
|
3
3
|
brilliance_admin/docs.py,sha256=fKeJKuiCCi1jHRmNcmkuDD6_2di7bwc6-w8V1VCTu0s,1231
|
|
4
4
|
brilliance_admin/exceptions.py,sha256=7_L3qVTwdLrzmDJjGv2yqCOVECP35wh0NyTvgjP7ETc,913
|
|
5
5
|
brilliance_admin/translations.py,sha256=I_iSfj05Qv5fbZqDvnnHZGUFsi1wk-J0EXSftKBLw5Q,3850
|
|
6
|
-
brilliance_admin/utils.py,sha256=
|
|
6
|
+
brilliance_admin/utils.py,sha256=M_0WANlb-1NW4aOA33MxOgoRx0GIVJ6w6PCGKAwmflk,5971
|
|
7
7
|
brilliance_admin/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
brilliance_admin/api/routers.py,sha256=GXz-GFXRH5VbDH1r5O9LLnnmaMhbQq4RctzVEubHnsk,810
|
|
9
9
|
brilliance_admin/api/utils.py,sha256=ezvHK49OlpCdT9fLB41Y1nswZDLdzC3zTcQtGtuTYUk,999
|
|
@@ -16,10 +16,10 @@ brilliance_admin/api/views/schema.py,sha256=MS9v9Qy3cRO9gGs4uW2PNRBS6Uw48sLRGRe4
|
|
|
16
16
|
brilliance_admin/api/views/settings.py,sha256=2A9suZQONEtW9LkFban29Fe5ipQaaGT0CzpxnbuotJQ,1166
|
|
17
17
|
brilliance_admin/api/views/table.py,sha256=29vLEwueHWBS8Dq6nBvujwy4CTs9v8ZcM1ErF9lYgIc,5932
|
|
18
18
|
brilliance_admin/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
-
brilliance_admin/integrations/sqlalchemy/__init__.py,sha256=
|
|
19
|
+
brilliance_admin/integrations/sqlalchemy/__init__.py,sha256=AmQHOvegS6_uaE4xYDHzRMdA9PyHn0cCt1s1IWc9G2U,318
|
|
20
20
|
brilliance_admin/integrations/sqlalchemy/auth.py,sha256=NvOLKeeSJuNTzFhisNO9R3sEmGRS8IQrCwghPrtuzaw,4924
|
|
21
|
-
brilliance_admin/integrations/sqlalchemy/autocomplete.py,sha256=
|
|
22
|
-
brilliance_admin/integrations/sqlalchemy/fields.py,sha256=
|
|
21
|
+
brilliance_admin/integrations/sqlalchemy/autocomplete.py,sha256=Q2BDwPL3d7FErqYkO-s6Q6pDg2PTZ1RUUAWc9tbllT8,1436
|
|
22
|
+
brilliance_admin/integrations/sqlalchemy/fields.py,sha256=piLGzX24GwCuWEBo7Jy0_8pMeiWc8tl9nj6Qt6ehYaY,9390
|
|
23
23
|
brilliance_admin/integrations/sqlalchemy/fields_schema.py,sha256=7WkOrt5dVvrsZppNZEZS8QaQPMSrfcWChwOaOFSRVOg,11419
|
|
24
24
|
brilliance_admin/integrations/sqlalchemy/table/__init__.py,sha256=g_in2pLTi8UQnT5uNFA8mLW5mxlT84irQ7yVaP_OSS4,605
|
|
25
25
|
brilliance_admin/integrations/sqlalchemy/table/base.py,sha256=-osqhTvqE7YcBxsAjqIUMWyYk1df04GIDmdvtieTXcg,4885
|
|
@@ -30,22 +30,21 @@ brilliance_admin/integrations/sqlalchemy/table/retrieve.py,sha256=O6mJ_XxfLJ59Hx
|
|
|
30
30
|
brilliance_admin/integrations/sqlalchemy/table/update.py,sha256=RfIXTQHHEoZCrOtVeOxZ3ql0-is5czsgVAfO_1_gF7w,3578
|
|
31
31
|
brilliance_admin/locales/en.yml,sha256=hq4ktzZZYmfbI7RVHHwvkUD9qjETMW1Fq2DQPCQAPao,1159
|
|
32
32
|
brilliance_admin/locales/ru.yml,sha256=ySYstybcfNhWUgdYeTnepaddgOlPTu4cIAWKLAVYLeo,1770
|
|
33
|
-
brilliance_admin/schema/__init__.py,sha256=
|
|
34
|
-
brilliance_admin/schema/admin_schema.py,sha256=
|
|
35
|
-
brilliance_admin/schema/category.py,sha256=
|
|
36
|
-
brilliance_admin/schema/group.py,sha256=Gdz3ME_EfQP_CFPou6OOJZWGWXKIYgB3zNX_oWsClwE,2240
|
|
33
|
+
brilliance_admin/schema/__init__.py,sha256=tZIRTSKFsNOmDqjoAgtYthYrT8ljPvLnYRzfupBLT00,290
|
|
34
|
+
brilliance_admin/schema/admin_schema.py,sha256=9w88GuogRjdphFuDdx7On553qHTwGoJVCyKpooFSKQ8,6723
|
|
35
|
+
brilliance_admin/schema/category.py,sha256=D2aIpDyL-2CibkpenNu8uyh4AzOdQ2ArTDltVYS7xZQ,6592
|
|
37
36
|
brilliance_admin/schema/graphs/__init__.py,sha256=qvmZv9QWdiutPtN5VYQLYbsjY2SOg8p_XRaz2rUlIxY,44
|
|
38
|
-
brilliance_admin/schema/graphs/category_graphs.py,sha256=
|
|
37
|
+
brilliance_admin/schema/graphs/category_graphs.py,sha256=iTjwjQoZocEfJWJEAdYcJTGCLXWexJVpOiKSfGzrRS8,1486
|
|
39
38
|
brilliance_admin/schema/table/__init__.py,sha256=vuRw8HBuak2LaTZi2dNn5YOrJPalQps-O3Ht-d0AZV4,378
|
|
40
39
|
brilliance_admin/schema/table/admin_action.py,sha256=0ymRL9DKkBK-AF6wKy7K9R4hkmblh55eHuZA_rjO1Lk,2018
|
|
41
|
-
brilliance_admin/schema/table/category_table.py,sha256=
|
|
40
|
+
brilliance_admin/schema/table/category_table.py,sha256=YNDEabnKkIjqhZ0niVOFqXDFIk0I2H6_FbGgbuO5NZ8,6509
|
|
42
41
|
brilliance_admin/schema/table/fields_schema.py,sha256=Tlnxpzb1RgMKLDqFpRD3t6x9lDEAf--hnmzRC3vHZpo,8350
|
|
43
42
|
brilliance_admin/schema/table/table_models.py,sha256=xidraifRYbXGkiVLn6dJ96dkOhW8-22ynE-fbiOjfAU,1018
|
|
44
43
|
brilliance_admin/schema/table/fields/__init__.py,sha256=RW-sIFTAaSQo4mMR6iWtnefogWPjmg6KAsDwe9mKW1k,291
|
|
45
44
|
brilliance_admin/schema/table/fields/base.py,sha256=fllUue5ZWj8qA8FGm72zyLHDNyGCkWHLxzpTx6dLLXQ,8507
|
|
46
45
|
brilliance_admin/schema/table/fields/function_field.py,sha256=4fm9kS8zpBG5oqp9sA81NQDHiqvU0BQmpf-wjkTuuwM,1780
|
|
47
|
-
brilliance_admin/static/index-
|
|
48
|
-
brilliance_admin/static/index-
|
|
46
|
+
brilliance_admin/static/index-MLuDem5W.js,sha256=jX6-PrXme02sFVpjjHP6ougUsWyZS550hMS3np3DDq4,3203238
|
|
47
|
+
brilliance_admin/static/index-P_wdMBbz.css,sha256=Cp6VOK3Vb3pRGYOdLR7fnthIfMD1Kzmey6xPkBc1Jw0,983016
|
|
49
48
|
brilliance_admin/static/materialdesignicons-webfont-CYDMK1kx.woff2,sha256=5S1g9kJnzaoIQitQurXUW9NeZisDua91F5zq4ArF_Is,385360
|
|
50
49
|
brilliance_admin/static/materialdesignicons-webfont-CgCzGbLl.woff,sha256=SNPuxqtw3HoZCPm6LyCOClhxi57hbj9qvbXbT0Yfolg,561776
|
|
51
50
|
brilliance_admin/static/materialdesignicons-webfont-D3kAzl71.ttf,sha256=vXJaejiTnltZkE4benJlkZ7OwlYWbs5p1RXCEAUWWQc,1243500
|
|
@@ -66,9 +65,9 @@ brilliance_admin/static/tinymce/plugins/accordion/css/accordion.css,sha256=u5UQk
|
|
|
66
65
|
brilliance_admin/static/tinymce/plugins/codesample/css/prism.css,sha256=exAdMtHbvwW7-DEs567MX65Fq1aJQTfREP5pw8gW-AY,1736
|
|
67
66
|
brilliance_admin/static/tinymce/plugins/customLink/plugin.js,sha256=illBNpnHDkBsLG6wo_jDPF6z7CGnO1MQWUoDwZKy6vQ,5589
|
|
68
67
|
brilliance_admin/static/tinymce/plugins/customLink/css/link.css,sha256=gh5nvY8Z92hJfCEBPnIm4jIPCcKKbJnab-30oIfX7Hc,56
|
|
69
|
-
brilliance_admin/templates/index.html,sha256=
|
|
70
|
-
brilliance_admin-0.
|
|
71
|
-
brilliance_admin-0.
|
|
72
|
-
brilliance_admin-0.
|
|
73
|
-
brilliance_admin-0.
|
|
74
|
-
brilliance_admin-0.
|
|
68
|
+
brilliance_admin/templates/index.html,sha256=EQwPtT7VCF-xcFQMtbNNwZhNOFUaGYM3SI71H9LkNCo,1294
|
|
69
|
+
brilliance_admin-0.44.0.dist-info/licenses/LICENSE,sha256=rgWE5Cxk53W0PhTOVmcQedABEWN1QMG-PRz3fz531sE,1074
|
|
70
|
+
brilliance_admin-0.44.0.dist-info/METADATA,sha256=oE9FJkKtqMQqBx7LKpzJXQVxZcIIeO4Gpt5f-sol3QY,6798
|
|
71
|
+
brilliance_admin-0.44.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
72
|
+
brilliance_admin-0.44.0.dist-info/top_level.txt,sha256=almFFSWrVYieI3i54hYL0fMUaeuIYiazS2Kx4wtK-ns,17
|
|
73
|
+
brilliance_admin-0.44.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Brilliance Admin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
brilliance_admin/schema/group.py
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import abc
|
|
2
|
-
from typing import Dict, List
|
|
3
|
-
|
|
4
|
-
from pydantic.dataclasses import dataclass
|
|
5
|
-
|
|
6
|
-
from brilliance_admin.auth import UserABC
|
|
7
|
-
from brilliance_admin.schema.category import Category, CategorySchemaData
|
|
8
|
-
from brilliance_admin.translations import LanguageContext
|
|
9
|
-
from brilliance_admin.utils import DataclassBase, SupportsStr, get_logger
|
|
10
|
-
|
|
11
|
-
logger = get_logger()
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@dataclass
|
|
15
|
-
class GroupSchemaData(DataclassBase):
|
|
16
|
-
title: str | None
|
|
17
|
-
description: str | None
|
|
18
|
-
icon: str | None
|
|
19
|
-
categories: Dict[str, CategorySchemaData]
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@dataclass
|
|
23
|
-
class Group(abc.ABC):
|
|
24
|
-
categories: List[Category]
|
|
25
|
-
slug: str
|
|
26
|
-
title: SupportsStr | None = None
|
|
27
|
-
description: SupportsStr | None = None
|
|
28
|
-
|
|
29
|
-
# https://pictogrammers.com/library/mdi/
|
|
30
|
-
icon: str | None = None
|
|
31
|
-
|
|
32
|
-
def __post_init__(self):
|
|
33
|
-
for category in self.categories:
|
|
34
|
-
if not issubclass(category.__class__, Category):
|
|
35
|
-
raise TypeError(f'Category "{category}" is not instance of Category subclass')
|
|
36
|
-
|
|
37
|
-
def generate_schema(self, user: UserABC, language_context: LanguageContext) -> GroupSchemaData:
|
|
38
|
-
result = GroupSchemaData(
|
|
39
|
-
title=language_context.get_text(self.title) or self.slug,
|
|
40
|
-
description=language_context.get_text(self.description),
|
|
41
|
-
icon=self.icon,
|
|
42
|
-
categories={},
|
|
43
|
-
)
|
|
44
|
-
if not self.categories:
|
|
45
|
-
logger.warning('Group "%s" %s.categories is empty!', self.slug, type(self).__name__)
|
|
46
|
-
|
|
47
|
-
for category in self.categories:
|
|
48
|
-
|
|
49
|
-
if not category.slug:
|
|
50
|
-
msg = f'Category {type(category).__name__}.slug is empty'
|
|
51
|
-
raise AttributeError(msg)
|
|
52
|
-
|
|
53
|
-
if category.slug in result.categories:
|
|
54
|
-
exists = result.categories[category.slug]
|
|
55
|
-
msg = f'Category {type(category).__name__}.slug "{self.slug}" already registered by "{exists.title}"'
|
|
56
|
-
raise KeyError(msg)
|
|
57
|
-
|
|
58
|
-
result.categories[category.slug] = category.generate_schema(user, language_context)
|
|
59
|
-
|
|
60
|
-
return result
|
|
61
|
-
|
|
62
|
-
def get_category(self, category_slug: str) -> Category | None:
|
|
63
|
-
for category in self.categories:
|
|
64
|
-
if category.slug == category_slug:
|
|
65
|
-
return category
|
|
66
|
-
|
|
67
|
-
return None
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: brilliance-admin
|
|
3
|
-
Version: 0.43.6
|
|
4
|
-
Summary: Simple and lightweight admin panel framework powered by FastAPI and Vue3 Vuetify together.. Some call it heavenly in its brilliance.
|
|
5
|
-
License-Expression: AGPL-3.0
|
|
6
|
-
Requires-Python: >=3.10
|
|
7
|
-
Description-Content-Type: text/markdown
|
|
8
|
-
License-File: LICENSE
|
|
9
|
-
Requires-Dist: asgiref>=3.11
|
|
10
|
-
Requires-Dist: fastapi>=0.115
|
|
11
|
-
Requires-Dist: jinja2>=3.1
|
|
12
|
-
Requires-Dist: PyYAML>=6.0
|
|
13
|
-
Provides-Extra: example
|
|
14
|
-
Requires-Dist: uvicorn>=0.34.0; extra == "example"
|
|
15
|
-
Requires-Dist: faker>=38.2.0; extra == "example"
|
|
16
|
-
Requires-Dist: pyjwt>=2.10.1; extra == "example"
|
|
17
|
-
Requires-Dist: structlog>=25.5.0; extra == "example"
|
|
18
|
-
Requires-Dist: rich>=14.2.0; extra == "example"
|
|
19
|
-
Provides-Extra: tests
|
|
20
|
-
Requires-Dist: pytest>=8.4.2; extra == "tests"
|
|
21
|
-
Requires-Dist: pytest-asyncio>=1.2.0; extra == "tests"
|
|
22
|
-
Requires-Dist: httpx>=0.28.1; extra == "tests"
|
|
23
|
-
Requires-Dist: pytest-mock>=3.15.1; extra == "tests"
|
|
24
|
-
Requires-Dist: sqlalchemy>=2.0.41; extra == "tests"
|
|
25
|
-
Requires-Dist: aiosqlite>=0.22.1; extra == "tests"
|
|
26
|
-
Requires-Dist: factory-boy>=3.3.3; extra == "tests"
|
|
27
|
-
Requires-Dist: pyjwt>=2.10.1; extra == "tests"
|
|
28
|
-
Provides-Extra: scalar
|
|
29
|
-
Requires-Dist: scalar-fastapi>=1.5.0; extra == "scalar"
|
|
30
|
-
Dynamic: license-file
|
|
31
|
-
|
|
32
|
-
<div align="center">
|
|
33
|
-
<img src="https://github.com/brilliance-admin/backend-python/blob/main/example/static/logo-outline.png?raw=true"
|
|
34
|
-
alt="Brilliance Admin"
|
|
35
|
-
width="600">
|
|
36
|
-
|
|
37
|
-
[](https://pypi.org/project/brilliance-admin/)
|
|
38
|
-
[](https://github.com/brilliance-admin/backend-python/actions)
|
|
39
|
-
|
|
40
|
-
Simple and lightweight admin panel framework powered by `FastAPI` and `Vue3` `Vuetify` together. \
|
|
41
|
-
Integrated with `SQLAlchemy`. Inspaired by Django Admin and DRF.\
|
|
42
|
-
_Some call it heavenly in its brilliance._
|
|
43
|
-
|
|
44
|
-
### [Live Demo](https://brilliance-admin.com/) | [Demo Sources](https://github.com/brilliance-admin/backend-python/tree/main/example) | Documentation (todo)
|
|
45
|
-
|
|
46
|
-
<img src="https://github.com/brilliance-admin/backend-python/blob/main/screenshots/websitemockupgenerator.png?raw=true"
|
|
47
|
-
alt="Preview">
|
|
48
|
-
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
**Key ideas:**
|
|
52
|
-
- **API oriented**\
|
|
53
|
-
Works entirely on FastAPI and provides a prebuilt SPA [frontend](https://github.com/brilliance-admin/frontend) via static files (Vue3 + Vuetify). No separate startup is required.
|
|
54
|
-
> Data generation/updating API separated from rendering fontend with zero hardcode, this makes it possible to have a single frontend with multiple backend implementations in different languages and makes test coverage easier.
|
|
55
|
-
- **Rich visualization**\
|
|
56
|
-
Providing rich and convenient ways to display and manage data (tables, charts, etc) from any data source.
|
|
57
|
-
- **ORM**\
|
|
58
|
-
Automatic schema generation and methods for CRUD operations.
|
|
59
|
-
- **Minimal boilerplate**\
|
|
60
|
-
Focused on simplified, but rich configuration.
|
|
61
|
-
|
|
62
|
-
**How it works:**
|
|
63
|
-
- After authentication, the user receives the admin panel schema, and the frontend renders it
|
|
64
|
-
- The frontend communicates with the backend via API to fetch and modify data
|
|
65
|
-
|
|
66
|
-
### Features:
|
|
67
|
-
|
|
68
|
-
* Tables with full CRUD support, including filtering, sorting, and pagination.
|
|
69
|
-
* Ability to define custom table actions with forms, response messages, and file downloads.
|
|
70
|
-
* Graphs via ChartJS
|
|
71
|
-
* Localization support
|
|
72
|
-
* Adapted for different screen sizes and mobile devices
|
|
73
|
-
* Authorization via any account data source
|
|
74
|
-
|
|
75
|
-
**Integrations:**
|
|
76
|
-
* **SQLAlchemy** - schema autogeneration for tables + CRUD operations + authorization
|
|
77
|
-
|
|
78
|
-
**Planned:**
|
|
79
|
-
* Role-based access control system
|
|
80
|
-
* Nested data support for creation and detail views
|
|
81
|
-
* Django ORM inegration
|
|
82
|
-
|
|
83
|
-
## How to use it
|
|
84
|
-
|
|
85
|
-
Installation:
|
|
86
|
-
``` shell
|
|
87
|
-
pip install brilliance-admin
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
You need to generate `AdminSchema` instance:
|
|
91
|
-
``` python
|
|
92
|
-
from brilliance_admin import schema
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
class CategoryExample(schema.CategoryTable):
|
|
96
|
-
"Implementation of get_list and retrieve; update and create are optional"
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
admin_schema = schema.AdminSchema(
|
|
100
|
-
title='Admin Panel',
|
|
101
|
-
auth=YourAdminAuthentication(),
|
|
102
|
-
groups=[
|
|
103
|
-
schema.Group(
|
|
104
|
-
slug='example',
|
|
105
|
-
title='Example',
|
|
106
|
-
icon='mdi-star',
|
|
107
|
-
categories=[
|
|
108
|
-
CategoryExample(),
|
|
109
|
-
]
|
|
110
|
-
),
|
|
111
|
-
],
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
admin_app = admin_schema.generate_app()
|
|
115
|
-
|
|
116
|
-
# Your FastAPI app
|
|
117
|
-
app = FastAPI()
|
|
118
|
-
app.mount('/admin', admin_app)
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
## SQLAlchemy integration
|
|
122
|
-
|
|
123
|
-
Supports automatic schema generation for CRUD tables:
|
|
124
|
-
|
|
125
|
-
``` python
|
|
126
|
-
category = sqlalchemy.SQLAlchemyAdmin(db_async_session=async_sessionmaker, model=Terminal)
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
> [!NOTE]
|
|
130
|
-
> If `table_schema` is not specified, it will be generated automatically with all discovered fields and relationships
|
|
131
|
-
|
|
132
|
-
Now, the `category` instance can be passed to `categories`.
|
|
133
|
-
|
|
134
|
-
### DRF class style schema
|
|
135
|
-
|
|
136
|
-
``` python
|
|
137
|
-
from brilliance_admin import sqlalchemy
|
|
138
|
-
from brilliance_admin.translations import TranslateText as _
|
|
139
|
-
|
|
140
|
-
from your_project.models import Terminal
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
class TerminalFiltersSchema(sqlalchemy.SQLAlchemyFieldsSchema):
|
|
144
|
-
model = Terminal
|
|
145
|
-
fields = ['id', 'created_at']
|
|
146
|
-
created_at = schema.DateTimeField(range=True)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
class TerminalSchema(sqlalchemy.SQLAlchemyFieldsSchema):
|
|
150
|
-
model = Terminal
|
|
151
|
-
list_display = ['id', 'merchant_id']
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
class TerminalAdmin(sqlalchemy.SQLAlchemyAdmin):
|
|
155
|
-
db_async_session = async_sessionmaker
|
|
156
|
-
model = Terminal
|
|
157
|
-
title = _('terminals')
|
|
158
|
-
icon = 'mdi-console-network-outline'
|
|
159
|
-
|
|
160
|
-
ordering_fields = ['id']
|
|
161
|
-
search_fields = ['id', 'title']
|
|
162
|
-
|
|
163
|
-
table_schema = TerminalSchema()
|
|
164
|
-
table_filters = TerminalFiltersSchema()
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
category = TerminalAdmin()
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### Can be used both via inheritance and instancing
|
|
171
|
-
|
|
172
|
-
Optionally, functional-style generation can be used to reduce boilerplate code
|
|
173
|
-
|
|
174
|
-
Availiable for `SQLAlchemyAdmin` and `SQLAlchemyFieldsSchema`
|
|
175
|
-
|
|
176
|
-
``` python
|
|
177
|
-
category = sqlalchemy.SQLAlchemyAdmin(
|
|
178
|
-
db_async_session=async_sessionmaker,
|
|
179
|
-
model=Terminal,
|
|
180
|
-
|
|
181
|
-
table_schema = sqlalchemy.SQLAlchemyFieldsSchema(
|
|
182
|
-
model=Terminal,
|
|
183
|
-
list_display=['id', 'merchant_id'],
|
|
184
|
-
),
|
|
185
|
-
table_filters = sqlalchemy.SQLAlchemyFieldsSchema(
|
|
186
|
-
model=Terminal,
|
|
187
|
-
fields=['id', 'created_at'],
|
|
188
|
-
created_at=schema.DateTimeField(range=True),
|
|
189
|
-
),
|
|
190
|
-
)
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
### SQLAlchemy JWT Authentication
|
|
194
|
-
|
|
195
|
-
``` python
|
|
196
|
-
auth = sqlalchemy.SQLAlchemyJWTAdminAuthentication(
|
|
197
|
-
secret='auth_secret',
|
|
198
|
-
db_async_session=async_session,
|
|
199
|
-
user_model=User,
|
|
200
|
-
)
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
## Comparison of Similar Projects
|
|
204
|
-
|
|
205
|
-
| Criterion | Brilliance Admin | Django Admin/Unfold | FastAPI Admin | Starlette Admin |
|
|
206
|
-
|---------|------------------|---------------|---------------|-----------------|
|
|
207
|
-
| Base framework | FastAPI | Django | FastAPI | Starlette / FastAPI |
|
|
208
|
-
| Rendering model | Prebuilt Vue 3 + Vuetify SPA + Jinja2 | Server-side Django templates | Server-side Jinja2 templates + Tabler UI | Server-side Jinja2 templates + Tabler UI |
|
|
209
|
-
| Frontend architecture | Separate frontend (SPA) | Classic server-rendered UI | Server-rendered UI with JS interactivity | Server-rendered UI with JS interactivity |
|
|
210
|
-
| Data source | Any source + SQLAlchemy | Django ORM | Tortoise ORM | Any source + SQLAlchemy, MongoDB |
|
|
211
|
-
| Multiple databases per model | Yes | Database routers | No (global engine) | Yes (session per ModelView) |
|
|
212
|
-
| Schema generation | User-defined format | From Django models | From ORM models | User-defined format |
|
|
213
|
-
| Async support | Yes | No | Yes | Yes |
|
|
214
|
-
| API-first approach | Yes | No | Partially | Partially |
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
GNU AFFERO GENERAL PUBLIC LICENSE
|
|
2
|
-
Version 3, 19 November 2007
|
|
3
|
-
|
|
4
|
-
Copyright (C) 2025 Your Name
|
|
5
|
-
|
|
6
|
-
This program is free software: you can redistribute it and/or modify
|
|
7
|
-
it under the terms of the GNU Affero General Public License as published
|
|
8
|
-
by the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
(at your option) any later version.
|
|
10
|
-
|
|
11
|
-
This program is distributed in the hope that it will be useful,
|
|
12
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
GNU Affero General Public License for more details.
|
|
15
|
-
|
|
16
|
-
You should have received a copy of the GNU Affero General Public License
|
|
17
|
-
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
File without changes
|
|
File without changes
|