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

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: django-ninja-aio-crud
3
- Version: 2.11.1
3
+ Version: 2.12.0
4
4
  Summary: Django Ninja AIO CRUD - Rest Framework
5
5
  Author: Giuseppe Casillo
6
6
  Requires-Python: >=3.10, <3.15
@@ -1,4 +1,4 @@
1
- ninja_aio/__init__.py,sha256=lbKW8_3c2S8qEgGVj2hcT_ajL3kqrk8xwcGdWo1uf4I,120
1
+ ninja_aio/__init__.py,sha256=vbhcy0b0GEAvlhzDMwqTW0244wyujnu_6FIEN3S3GJs,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
@@ -14,8 +14,8 @@ ninja_aio/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
14
14
  ninja_aio/helpers/api.py,sha256=2beyexep-ehgaA_1bV5Yuh3zRDVcRCMkrW94nmfDWEA,20819
15
15
  ninja_aio/helpers/query.py,sha256=NMGkS_v-ZVYKNtf1XohEUzfwca52Eq5FTcQ5lehHjus,4682
16
16
  ninja_aio/models/__init__.py,sha256=L3UQnQAlKoI3F7jinadL-Nn55hkPvnSRPYW0JtnbWFo,114
17
- ninja_aio/models/serializers.py,sha256=I7pUz_vl0FElaVsrGaogT_Lj9T4uaNG7UDMGf5VMwW4,38468
18
- ninja_aio/models/utils.py,sha256=dxzwqE25b0lFZ--30XxeIJB-y4xbIDtc624vGaa_wOg,32885
17
+ ninja_aio/models/serializers.py,sha256=uLy0FlVWw7aqr4K0UDk4In-QFGjYLL9RfPX103ApV10,38603
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
@@ -24,7 +24,7 @@ ninja_aio/schemas/helpers.py,sha256=Vti5BfHWpxaJXj_ixZBJb34VRwhHODrlVjRlIuHh_ug,
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.11.1.dist-info/licenses/LICENSE,sha256=yrDAYcm0gRp_Qyzo3GQa4BjYjWRkAhGC8QRva__RYq0,1073
28
- django_ninja_aio_crud-2.11.1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
29
- django_ninja_aio_crud-2.11.1.dist-info/METADATA,sha256=7ki9usiKl0L81q7qzlOGkjQCeJrKkPn6KXTq7CNs8D4,9964
30
- django_ninja_aio_crud-2.11.1.dist-info/RECORD,,
27
+ django_ninja_aio_crud-2.12.0.dist-info/licenses/LICENSE,sha256=yrDAYcm0gRp_Qyzo3GQa4BjYjWRkAhGC8QRva__RYq0,1073
28
+ django_ninja_aio_crud-2.12.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
29
+ django_ninja_aio_crud-2.12.0.dist-info/METADATA,sha256=0SnKArx4qdFLcTE97doPAIsv7BxTPDbvTHeR6wfh-5g,9964
30
+ django_ninja_aio_crud-2.12.0.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.11.1"
3
+ __version__ = "2.12.0"
4
4
 
5
5
  from .api import NinjaAIO
6
6
 
@@ -333,11 +333,7 @@ class BaseSerializer:
333
333
  @classmethod
334
334
  def get_fields(cls, s_type: S_TYPES):
335
335
  """Return explicit declared fields for the serializer type."""
336
- fields = cls._get_fields(s_type, "fields")
337
- # Detail schema falls back to read fields if none declared
338
- if not fields and s_type == "detail":
339
- return cls._get_fields("read", "fields")
340
- return fields
336
+ return cls._get_fields(s_type, "fields")
341
337
 
342
338
  @classmethod
343
339
  def is_custom(cls, field: str) -> bool:
@@ -428,8 +424,9 @@ class BaseSerializer:
428
424
  @classmethod
429
425
  def _warn_missing_relation_serializer(cls, field_name: str, model) -> None:
430
426
  """Emit warning for reverse relations without explicit serializer mapping."""
431
- if not isinstance(model, ModelSerializerMeta) and not getattr(
432
- settings, "NINJA_AIO_TESTING", False
427
+ if not isinstance(model, ModelSerializerMeta) and (
428
+ not getattr(settings, "NINJA_AIO_TESTING", False)
429
+ or getattr(settings, "NINJA_AIO_RAISE_SERIALIZATION_WARNINGS", False)
433
430
  ):
434
431
  warnings.warn(
435
432
  f"{cls.__name__}: reverse relation '{field_name}' is listed in read fields "
@@ -781,7 +778,10 @@ class ModelSerializer(models.Model, BaseSerializer, metaclass=ModelSerializerMet
781
778
  if not config_class_name:
782
779
  return []
783
780
  config_class = getattr(cls, config_class_name)
784
- return getattr(config_class, f_type, [])
781
+ fields = getattr(config_class, f_type, [])
782
+ if not fields and s_type == "detail":
783
+ fields = getattr(cls.ReadSerializer, f_type, [])
784
+ return fields
785
785
 
786
786
  @classmethod
787
787
  def _get_model(cls) -> "ModelSerializer":
@@ -1006,7 +1006,10 @@ class Serializer(BaseSerializer, metaclass=SerializerMeta):
1006
1006
  return []
1007
1007
  schema = cls._get_schema_meta(schema_key)
1008
1008
  if not schema:
1009
- return []
1009
+ if s_type == "detail":
1010
+ schema = cls._get_schema_meta("out")
1011
+ else:
1012
+ return []
1010
1013
  return getattr(schema, f_type, []) or []
1011
1014
 
1012
1015
  @classmethod
ninja_aio/models/utils.py CHANGED
@@ -601,7 +601,7 @@ class ModelUtil:
601
601
  async def _bump_object_from_schema(
602
602
  self, obj: type["ModelSerializer"] | models.Model, schema: Schema
603
603
  ):
604
- return (await sync_to_async(schema.from_orm)(obj)).model_dump(mode="json")
604
+ return (await sync_to_async(schema.from_orm)(obj)).model_dump()
605
605
 
606
606
  def _validate_read_params(self, request: HttpRequest, query_data: QuerySchema):
607
607
  """Validate required parameters for read operations."""