django-ninja-aio-crud 0.3.0__py3-none-any.whl → 0.3.1__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.
- {django_ninja_aio_crud-0.3.0.dist-info → django_ninja_aio_crud-0.3.1.dist-info}/METADATA +2 -2
- django_ninja_aio_crud-0.3.1.dist-info/RECORD +13 -0
- {django_ninja_aio_crud-0.3.0.dist-info → django_ninja_aio_crud-0.3.1.dist-info}/WHEEL +1 -1
- ninja_aio/__init__.py +1 -1
- ninja_aio/api.py +2 -2
- ninja_aio/models.py +1 -1
- ninja_aio/renders.py +8 -5
- django_ninja_aio_crud-0.3.0.dist-info/RECORD +0 -13
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
ninja_aio/__init__.py,sha256=_tjey_xwfvsIhCY5_zwh_pEW7Iubpix0RnfUSx_x9to,120
|
|
2
|
+
ninja_aio/api.py,sha256=r0BOsZLdH-kqInbbXPmK8HeF-fQz756ih-MSFvfEBXI,1546
|
|
3
|
+
ninja_aio/auth.py,sha256=hGgiblvffpHmmakjaxdNT3G0tq39-Bvc5oLNqjn4qd8,1300
|
|
4
|
+
ninja_aio/exceptions.py,sha256=PPNr1CdC7M7Kx1MtiBGuR4hATYQqEuvxCRU6uSG7rgM,543
|
|
5
|
+
ninja_aio/models.py,sha256=Ni4nO9U2DeWA3STX2wV8Jk5esqgwOSzfW7ZvA4hu1Hg,16500
|
|
6
|
+
ninja_aio/parsers.py,sha256=e_4lGCPV7zs-HTqtdJTc8yQD2KPAn9njbL8nF_Mmgkc,153
|
|
7
|
+
ninja_aio/renders.py,sha256=mHeKNJtmDhZmgFpS9B6SPn5uZFcyVXrsoMhr149LeW8,1555
|
|
8
|
+
ninja_aio/schemas.py,sha256=EgRkfhnzZqwGvdBmqlZixMtMcoD1ZxV_qzJ3fmaAy20,113
|
|
9
|
+
ninja_aio/types.py,sha256=gEHb6O9M07o5DHtxXH_KAcFJdq9lzq3ljmYbNLst8vs,297
|
|
10
|
+
ninja_aio/views.py,sha256=LcUoCyBs4Sbgz8ugcu9nfm30xCKnEnEalROg-mUOCTg,7117
|
|
11
|
+
django_ninja_aio_crud-0.3.1.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
|
|
12
|
+
django_ninja_aio_crud-0.3.1.dist-info/METADATA,sha256=c6tJqkqsYu7iUZdP5X5Rbm2jsGkeZOMAVGlDxtEJCOI,10135
|
|
13
|
+
django_ninja_aio_crud-0.3.1.dist-info/RECORD,,
|
ninja_aio/__init__.py
CHANGED
ninja_aio/api.py
CHANGED
|
@@ -6,8 +6,8 @@ from ninja import NinjaAPI
|
|
|
6
6
|
from ninja.openapi.docs import DocsBase, Swagger
|
|
7
7
|
from ninja.constants import NOT_SET, NOT_SET_TYPE
|
|
8
8
|
|
|
9
|
-
from
|
|
10
|
-
from
|
|
9
|
+
from .parsers import ORJSONParser
|
|
10
|
+
from .renders import ORJSONRenderer
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class NinjaAIO(NinjaAPI):
|
ninja_aio/models.py
CHANGED
|
@@ -41,7 +41,7 @@ class ModelUtil:
|
|
|
41
41
|
raise SerializeError({self.model._meta.model_name: "not found"}, 404)
|
|
42
42
|
return obj
|
|
43
43
|
|
|
44
|
-
def get_reverse_relations(self):
|
|
44
|
+
def get_reverse_relations(self) -> list[str]:
|
|
45
45
|
reverse_rels = []
|
|
46
46
|
for f in self.serializable_fields:
|
|
47
47
|
field_obj = getattr(self.model, f)
|
ninja_aio/renders.py
CHANGED
|
@@ -9,11 +9,14 @@ class ORJSONRenderer(BaseRenderer):
|
|
|
9
9
|
media_type = "application/json"
|
|
10
10
|
|
|
11
11
|
def render(self, request: HttpRequest, data: dict, *, response_status):
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
try:
|
|
13
|
+
old_d = data
|
|
14
|
+
for k, v in old_d.items():
|
|
15
|
+
if isinstance(v, list):
|
|
16
|
+
data |= {k: self.render_list(v)}
|
|
17
|
+
return orjson.dumps(self.render_dict(data))
|
|
18
|
+
except AttributeError:
|
|
19
|
+
return orjson.dumps(data)
|
|
17
20
|
|
|
18
21
|
@classmethod
|
|
19
22
|
def render_list(cls, data: list[dict]) -> list[dict]:
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
ninja_aio/__init__.py,sha256=iGCkR3-6rXWNYFHVELrzOjvLdtYRuqB6fdA_L9XTNoE,120
|
|
2
|
-
ninja_aio/api.py,sha256=qEnCOvviJGfg28N9R2XWzykLGOFpJ0JMqe3rm4AYDkM,1564
|
|
3
|
-
ninja_aio/auth.py,sha256=hGgiblvffpHmmakjaxdNT3G0tq39-Bvc5oLNqjn4qd8,1300
|
|
4
|
-
ninja_aio/exceptions.py,sha256=PPNr1CdC7M7Kx1MtiBGuR4hATYQqEuvxCRU6uSG7rgM,543
|
|
5
|
-
ninja_aio/models.py,sha256=eIE79SiwrRPpxFosSGq8hgnsWNnhpkQJJIELo4ieJl4,16487
|
|
6
|
-
ninja_aio/parsers.py,sha256=e_4lGCPV7zs-HTqtdJTc8yQD2KPAn9njbL8nF_Mmgkc,153
|
|
7
|
-
ninja_aio/renders.py,sha256=wLQisbIsMJlGYJMO4Ud-qiaVCvz4yxiZ4mYommixAeQ,1453
|
|
8
|
-
ninja_aio/schemas.py,sha256=EgRkfhnzZqwGvdBmqlZixMtMcoD1ZxV_qzJ3fmaAy20,113
|
|
9
|
-
ninja_aio/types.py,sha256=gEHb6O9M07o5DHtxXH_KAcFJdq9lzq3ljmYbNLst8vs,297
|
|
10
|
-
ninja_aio/views.py,sha256=LcUoCyBs4Sbgz8ugcu9nfm30xCKnEnEalROg-mUOCTg,7117
|
|
11
|
-
django_ninja_aio_crud-0.3.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
|
12
|
-
django_ninja_aio_crud-0.3.0.dist-info/METADATA,sha256=SyPJE6bWnCAjrmGYJzOkqVXIyeYD4lpwb6eHfHowRLI,10135
|
|
13
|
-
django_ninja_aio_crud-0.3.0.dist-info/RECORD,,
|