django-ninja-aio-crud 2.16.0__py3-none-any.whl → 2.16.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.

Potentially problematic release.


This version of django-ninja-aio-crud might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: django-ninja-aio-crud
3
- Version: 2.16.0
3
+ Version: 2.16.2
4
4
  Summary: Django Ninja AIO CRUD - Rest Framework
5
5
  Author: Giuseppe Casillo
6
6
  Requires-Python: >=3.10, <3.15
@@ -1,7 +1,7 @@
1
- ninja_aio/__init__.py,sha256=r0RyWWYURc6f5zZT0E9Rqx4tbu1WzKhXpUusNtGwQ7s,120
1
+ ninja_aio/__init__.py,sha256=T_ERynU6iChK83VokT16riNn-rjWDvI9TKAOwaEpy68,120
2
2
  ninja_aio/api.py,sha256=tuC7vdvn7s1GkCnSFy9Kn1zv0glZfYptRQVvo8ZRtGQ,2429
3
3
  ninja_aio/auth.py,sha256=f4yk45fLi36Qctu0A0zgHTFedb9yk3ewq5rOMpoPYIE,9035
4
- ninja_aio/exceptions.py,sha256=_3xFqfFCOfrrMhSA0xbMqgXy8R0UQjhXaExrFvaDAjY,3891
4
+ ninja_aio/exceptions.py,sha256=w8QWmVlg88iJvBrNODSDBHSsy8nNpwngaCGWRnkXoPo,3899
5
5
  ninja_aio/parsers.py,sha256=e_4lGCPV7zs-HTqtdJTc8yQD2KPAn9njbL8nF_Mmgkc,153
6
6
  ninja_aio/renders.py,sha256=CW0xDa05Xna-UvL0MZqZeDEgueEaUassV_nG7Rh1-cw,1824
7
7
  ninja_aio/types.py,sha256=E3yfXbNKkvLVcr8bvkHTSyIiCRZ4zumzJaXj1aiBi5U,735
@@ -14,7 +14,7 @@ ninja_aio/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
14
14
  ninja_aio/helpers/api.py,sha256=va_HvZVBFm1KxwQhH4u09U4F1JS5JrQuRpRmPTHJt7w,21326
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=fwuEQrBcybCNBHPo1i-EHXIX8F4Fd52iduZf_Cl9wE4,42823
17
+ ninja_aio/models/serializers.py,sha256=yUMfVu-95EuT5wet2nwFnQlxJYSm8CFGLwKlGr6QBao,43297
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
@@ -24,7 +24,7 @@ ninja_aio/schemas/helpers.py,sha256=CpubwNXsZHtu8jddliyQybF1epwZ-GO60vHIuF5AR1Y,
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.16.0.dist-info/licenses/LICENSE,sha256=yrDAYcm0gRp_Qyzo3GQa4BjYjWRkAhGC8QRva__RYq0,1073
28
- django_ninja_aio_crud-2.16.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
29
- django_ninja_aio_crud-2.16.0.dist-info/METADATA,sha256=Ub6OM-TaFA9SkIDd2b--wcc0xRAok3En5NvWjPsT07M,9964
30
- django_ninja_aio_crud-2.16.0.dist-info/RECORD,,
27
+ django_ninja_aio_crud-2.16.2.dist-info/licenses/LICENSE,sha256=yrDAYcm0gRp_Qyzo3GQa4BjYjWRkAhGC8QRva__RYq0,1073
28
+ django_ninja_aio_crud-2.16.2.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
29
+ django_ninja_aio_crud-2.16.2.dist-info/METADATA,sha256=k17Ia6_VlPDH92UIsN0OQjOrj_IYOfZyffyFMbrP-xw,9964
30
+ django_ninja_aio_crud-2.16.2.dist-info/RECORD,,
ninja_aio/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Django Ninja AIO CRUD - Rest Framework"""
2
2
 
3
- __version__ = "2.16.0"
3
+ __version__ = "2.16.2"
4
4
 
5
5
  from .api import NinjaAIO
6
6
 
ninja_aio/exceptions.py CHANGED
@@ -78,7 +78,7 @@ def _default_error(
78
78
 
79
79
 
80
80
  def _pydantic_validation_error(
81
- request: HttpRequest, exc: ValidationError, api: type[NinjaAPI]
81
+ request: HttpRequest, exc: PydanticValidationError, api: type[NinjaAPI]
82
82
  ) -> HttpResponse:
83
83
  """Translate a pydantic ValidationError into a normalized API error response."""
84
84
  error = PydanticValidationError(exc.errors(include_input=False))
@@ -669,9 +669,18 @@ class BaseSerializer:
669
669
  customs = cls.get_custom_fields(s_type) + optionals
670
670
  excludes = cls.get_excluded_fields(s_type)
671
671
 
672
- # If no explicit fields but have optionals, use optional field names as fields
672
+ # If no explicit fields and no excludes specified
673
673
  if not fields and not excludes:
674
- fields = [f[0] for f in optionals]
674
+ if optionals:
675
+ # Use optional field names as the fields to include
676
+ fields = [f[0] for f in optionals]
677
+ elif customs:
678
+ # Only customs defined - exclude all model fields to prevent auto-inclusion
679
+ excludes = [
680
+ f.name
681
+ for f in model._meta.get_fields()
682
+ if getattr(f, "concrete", False)
683
+ ]
675
684
 
676
685
  # Only create schema if we have something to include
677
686
  if not any([fields, customs, excludes]):
@@ -1037,18 +1046,18 @@ class SchemaModelConfig(Schema):
1037
1046
  ----------
1038
1047
  fields : Optional[List[str]]
1039
1048
  Explicit model fields to include.
1040
- optionals : Optional[List[tuple[str, type]]]
1041
- Optional model fields.
1049
+ optionals : Optional[List[tuple[str, Any]]]
1050
+ Optional model fields. Type can be any valid type annotation including Union.
1042
1051
  exclude : Optional[List[str]]
1043
1052
  Model fields to exclude.
1044
- customs : Optional[List[tuple[str, type, Any]]]
1045
- Custom / synthetic fields.
1053
+ customs : Optional[List[tuple[str, Any, Any]]]
1054
+ Custom / synthetic fields. Type can be any valid type annotation including Union.
1046
1055
  """
1047
1056
 
1048
1057
  fields: Optional[List[str]] = None
1049
- optionals: Optional[List[tuple[str, type]]] = None
1058
+ optionals: Optional[List[tuple[str, Any]]] = None
1050
1059
  exclude: Optional[List[str]] = None
1051
- customs: Optional[List[tuple[str, type, Any]]] = None
1060
+ customs: Optional[List[tuple[str, Any, Any]]] = None
1052
1061
 
1053
1062
 
1054
1063
  class Serializer(BaseSerializer, metaclass=SerializerMeta):