django-ninja-aio-crud 2.12.2__py3-none-any.whl → 2.13.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.
Potentially problematic release.
This version of django-ninja-aio-crud might be problematic. Click here for more details.
- {django_ninja_aio_crud-2.12.2.dist-info → django_ninja_aio_crud-2.13.0.dist-info}/METADATA +1 -1
- {django_ninja_aio_crud-2.12.2.dist-info → django_ninja_aio_crud-2.13.0.dist-info}/RECORD +8 -8
- ninja_aio/__init__.py +1 -1
- ninja_aio/helpers/api.py +11 -5
- ninja_aio/models/serializers.py +3 -4
- ninja_aio/schemas/helpers.py +4 -1
- {django_ninja_aio_crud-2.12.2.dist-info → django_ninja_aio_crud-2.13.0.dist-info}/WHEEL +0 -0
- {django_ninja_aio_crud-2.12.2.dist-info → django_ninja_aio_crud-2.13.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
ninja_aio/__init__.py,sha256=
|
|
1
|
+
ninja_aio/__init__.py,sha256=927xxMRmWc-R42YP-42eXiVvPNa8N9YLu1m4VPIaPvY,120
|
|
2
2
|
ninja_aio/api.py,sha256=tuC7vdvn7s1GkCnSFy9Kn1zv0glZfYptRQVvo8ZRtGQ,2429
|
|
3
3
|
ninja_aio/auth.py,sha256=4sWdFPjKiQgUL1d_CSGDblVjnY5ptP6LQha6XXdluJA,9157
|
|
4
4
|
ninja_aio/exceptions.py,sha256=_3xFqfFCOfrrMhSA0xbMqgXy8R0UQjhXaExrFvaDAjY,3891
|
|
@@ -11,20 +11,20 @@ ninja_aio/decorators/views.py,sha256=0RVU4XaM1HvTQ-BOt_NwUtbhwfHau06lh-O8El1LqQk
|
|
|
11
11
|
ninja_aio/factory/__init__.py,sha256=IdH2z1ZZpv_IqonaDfVo7IsMzkgop6lHqz42RphUYBU,72
|
|
12
12
|
ninja_aio/factory/operations.py,sha256=OgWGqq4WJ4arSQrH9FGAby9kx-HTdS7MOITxHdYMk18,12051
|
|
13
13
|
ninja_aio/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
-
ninja_aio/helpers/api.py,sha256=
|
|
14
|
+
ninja_aio/helpers/api.py,sha256=O2nGvP3VSsG-AReQRn90yDH8vS3kMKh125j-ikwgGoQ,20987
|
|
15
15
|
ninja_aio/helpers/query.py,sha256=Lqv4nrWYr543tC5K-SEcBottLID8cb83aDc26i2Wxj4,5053
|
|
16
16
|
ninja_aio/models/__init__.py,sha256=L3UQnQAlKoI3F7jinadL-Nn55hkPvnSRPYW0JtnbWFo,114
|
|
17
|
-
ninja_aio/models/serializers.py,sha256=
|
|
17
|
+
ninja_aio/models/serializers.py,sha256=VtyWiSGA9vOmxC2S-2lG6mvF33T61sUkNaDmGkAIiOM,38535
|
|
18
18
|
ninja_aio/models/utils.py,sha256=lAXtc3YY7_n4f0jIacX4DSXhUOzMy7y5MsBnInNxtfk,32874
|
|
19
19
|
ninja_aio/schemas/__init__.py,sha256=dHILiYBKMb51lDcyQdiXRw_0nzqM7Lu81UX2hv7kEfo,837
|
|
20
20
|
ninja_aio/schemas/api.py,sha256=dGUpJXR1iAf93QNR4kYj1uqIkTjiMfXultCotY6GtaQ,361
|
|
21
21
|
ninja_aio/schemas/filters.py,sha256=VxzH2xSWok8cUSkyfeqtrGhRewtFVmNHQfHNvY8Aynw,2662
|
|
22
22
|
ninja_aio/schemas/generics.py,sha256=frjJsKJMAdM_NdNKv-9ddZNGxYy5PNzjIRGtuycgr-w,112
|
|
23
|
-
ninja_aio/schemas/helpers.py,sha256=
|
|
23
|
+
ninja_aio/schemas/helpers.py,sha256=h4zQRf21NVLMQbIVH-psAE4FICUBc857EqngblEy7og,8636
|
|
24
24
|
ninja_aio/views/__init__.py,sha256=DEzjWA6y3WF0V10nNF8eEurLNEodgxKzyFd09AqVp3s,148
|
|
25
25
|
ninja_aio/views/api.py,sha256=AAqkj0xT8J3PmJvsbluZ33cfrmrXJHiV9ARe2BqnfQ8,22492
|
|
26
26
|
ninja_aio/views/mixins.py,sha256=Zl6J8gbVagwT85bzDuKyJTk3iFxxFgX0YgYkjiUxZGg,17040
|
|
27
|
-
django_ninja_aio_crud-2.
|
|
28
|
-
django_ninja_aio_crud-2.
|
|
29
|
-
django_ninja_aio_crud-2.
|
|
30
|
-
django_ninja_aio_crud-2.
|
|
27
|
+
django_ninja_aio_crud-2.13.0.dist-info/licenses/LICENSE,sha256=yrDAYcm0gRp_Qyzo3GQa4BjYjWRkAhGC8QRva__RYq0,1073
|
|
28
|
+
django_ninja_aio_crud-2.13.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
29
|
+
django_ninja_aio_crud-2.13.0.dist-info/METADATA,sha256=dj3-NSAn8DeyBSViefyGt8rLp_f5bfSaZmkbVaQ2gbA,9964
|
|
30
|
+
django_ninja_aio_crud-2.13.0.dist-info/RECORD,,
|
ninja_aio/__init__.py
CHANGED
ninja_aio/helpers/api.py
CHANGED
|
@@ -358,6 +358,7 @@ class ManyToManyAPI:
|
|
|
358
358
|
related_schema,
|
|
359
359
|
filters_schema,
|
|
360
360
|
append_slash: bool,
|
|
361
|
+
verbose_name_plural: str,
|
|
361
362
|
):
|
|
362
363
|
@self.router.get(
|
|
363
364
|
self._get_api_path(rel_path, append_slash=append_slash),
|
|
@@ -366,8 +367,8 @@ class ManyToManyAPI:
|
|
|
366
367
|
self.view_set.error_codes: GenericMessageSchema,
|
|
367
368
|
},
|
|
368
369
|
auth=m2m_auth,
|
|
369
|
-
summary=f"Get {
|
|
370
|
-
description=f"Get all related {
|
|
370
|
+
summary=f"Get {verbose_name_plural}",
|
|
371
|
+
description=f"Get all related {verbose_name_plural}",
|
|
371
372
|
)
|
|
372
373
|
@decorate_view(
|
|
373
374
|
unique_view(f"get_{self.related_model_util.model_name}_{rel_path}"),
|
|
@@ -402,13 +403,13 @@ class ManyToManyAPI:
|
|
|
402
403
|
related_model: ModelSerializer | Model,
|
|
403
404
|
related_name: str,
|
|
404
405
|
m2m_auth,
|
|
405
|
-
rel_util: ModelUtil,
|
|
406
406
|
rel_path: str,
|
|
407
407
|
m2m_add: bool,
|
|
408
408
|
m2m_remove: bool,
|
|
409
|
+
verbose_name_plural: str,
|
|
409
410
|
):
|
|
410
411
|
action, schema_in = self._resolve_action_schema(m2m_add, m2m_remove)
|
|
411
|
-
plural =
|
|
412
|
+
plural = verbose_name_plural
|
|
412
413
|
summary = f"{action} {plural}"
|
|
413
414
|
|
|
414
415
|
@self.router.post(
|
|
@@ -478,6 +479,10 @@ class ManyToManyAPI:
|
|
|
478
479
|
m2m_add, m2m_remove, m2m_get = relation.add, relation.remove, relation.get
|
|
479
480
|
filters_schema = self.relations_filters_schemas.get(related_name)
|
|
480
481
|
append_slash = relation.append_slash
|
|
482
|
+
verbose_name_plural = (
|
|
483
|
+
relation.verbose_name_plural
|
|
484
|
+
or rel_util.model._meta.verbose_name_plural.capitalize()
|
|
485
|
+
)
|
|
481
486
|
|
|
482
487
|
if m2m_get:
|
|
483
488
|
self._register_get_relation_view(
|
|
@@ -488,6 +493,7 @@ class ManyToManyAPI:
|
|
|
488
493
|
related_schema=related_schema,
|
|
489
494
|
filters_schema=filters_schema,
|
|
490
495
|
append_slash=append_slash,
|
|
496
|
+
verbose_name_plural=verbose_name_plural,
|
|
491
497
|
)
|
|
492
498
|
|
|
493
499
|
if m2m_add or m2m_remove:
|
|
@@ -495,10 +501,10 @@ class ManyToManyAPI:
|
|
|
495
501
|
related_model=model,
|
|
496
502
|
related_name=related_name,
|
|
497
503
|
m2m_auth=m2m_auth,
|
|
498
|
-
rel_util=rel_util,
|
|
499
504
|
rel_path=rel_path,
|
|
500
505
|
m2m_add=m2m_add,
|
|
501
506
|
m2m_remove=m2m_remove,
|
|
507
|
+
verbose_name_plural=verbose_name_plural,
|
|
502
508
|
)
|
|
503
509
|
|
|
504
510
|
def _add_views(self):
|
ninja_aio/models/serializers.py
CHANGED
|
@@ -424,10 +424,9 @@ class BaseSerializer:
|
|
|
424
424
|
@classmethod
|
|
425
425
|
def _warn_missing_relation_serializer(cls, field_name: str, model) -> None:
|
|
426
426
|
"""Emit warning for reverse relations without explicit serializer mapping."""
|
|
427
|
-
if (
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
) or getattr(settings, "NINJA_AIO_RAISE_SERIALIZATION_WARNINGS", False):
|
|
427
|
+
if not isinstance(model, ModelSerializerMeta) and getattr(
|
|
428
|
+
settings, "NINJA_AIO_RAISE_SERIALIZATION_WARNINGS", True
|
|
429
|
+
):
|
|
431
430
|
warnings.warn(
|
|
432
431
|
f"{cls.__name__}: reverse relation '{field_name}' is listed in read fields "
|
|
433
432
|
"but has no entry in relations_serializers; it will be auto-resolved only "
|
ninja_aio/schemas/helpers.py
CHANGED
|
@@ -44,7 +44,9 @@ class M2MRelationSchema(BaseModel):
|
|
|
44
44
|
it can be used to auto-generate the `related_schema`.
|
|
45
45
|
append_slash (bool):
|
|
46
46
|
Whether to append a trailing slash to the generated GET endpoint path. Defaults to False for backward compatibility.
|
|
47
|
-
|
|
47
|
+
verbose_name_plural (str | None):
|
|
48
|
+
Optional human-readable plural name for the related model, used in documentation and responses.
|
|
49
|
+
|
|
48
50
|
Validation:
|
|
49
51
|
- If `model` is not a ModelSerializerMeta, `related_schema` is required.
|
|
50
52
|
- When `model` is a ModelSerializerMeta and `related_schema` is not provided, it will be
|
|
@@ -69,6 +71,7 @@ class M2MRelationSchema(BaseModel):
|
|
|
69
71
|
related_schema: Optional[Type[Schema]] = None
|
|
70
72
|
serializer_class: Optional[SerializerMeta] = None
|
|
71
73
|
append_slash: bool = False
|
|
74
|
+
verbose_name_plural: Optional[str] = None
|
|
72
75
|
|
|
73
76
|
model_config = ConfigDict(arbitrary_types_allowed=True)
|
|
74
77
|
|
|
File without changes
|
{django_ninja_aio_crud-2.12.2.dist-info → django_ninja_aio_crud-2.13.0.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|