django-ninja-aio-crud 0.7.3__py3-none-any.whl → 0.7.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: django-ninja-aio-crud
3
- Version: 0.7.3
3
+ Version: 0.7.4
4
4
  Summary: Django Ninja AIO CRUD - Rest Framework
5
5
  Author: Giuseppe Casillo
6
6
  Requires-Python: >=3.10
@@ -1,14 +1,14 @@
1
- ninja_aio/__init__.py,sha256=lfBEFyqJlXlBY3tBnJ8_d3b1qVmx8aNY-C4-QNxTCH8,119
1
+ ninja_aio/__init__.py,sha256=mOBOfTz2rTIcK2p5GfONfds9MeHL41sf2sHhoR1WYag,119
2
2
  ninja_aio/api.py,sha256=Fe6l3YCy7MW5TY4-Lbl80CFuK2NT2Y7tHfmqPk6Mqak,1735
3
3
  ninja_aio/auth.py,sha256=fKboioU4sezPukKJukIwiboxml_KV7irhCH3vGYt5pU,1008
4
4
  ninja_aio/exceptions.py,sha256=gPnZX1Do2GXudbU8wDYkwhO70Qj0ZNrIJJ2UXRs9vYk,2241
5
- ninja_aio/models.py,sha256=JioOl0veqx_pqT7lYtZaLsR9HHCtgq0LRppd6_Yr_os,17146
5
+ ninja_aio/models.py,sha256=-Zh3UFmV3iIUIbMN93uN7v-VInoWp215Y_RXK3izuQI,17115
6
6
  ninja_aio/parsers.py,sha256=e_4lGCPV7zs-HTqtdJTc8yQD2KPAn9njbL8nF_Mmgkc,153
7
7
  ninja_aio/renders.py,sha256=mHeKNJtmDhZmgFpS9B6SPn5uZFcyVXrsoMhr149LeW8,1555
8
8
  ninja_aio/schemas.py,sha256=EgRkfhnzZqwGvdBmqlZixMtMcoD1ZxV_qzJ3fmaAy20,113
9
9
  ninja_aio/types.py,sha256=TJSGlA7bt4g9fvPhJ7gzH5tKbLagPmZUzfgttEOp4xs,468
10
10
  ninja_aio/views.py,sha256=qROag0OsMeVUXcnUYKV7ZmWj4E0F-QH52PI2-56zVRs,9263
11
- django_ninja_aio_crud-0.7.3.dist-info/licenses/LICENSE,sha256=yrDAYcm0gRp_Qyzo3GQa4BjYjWRkAhGC8QRva__RYq0,1073
12
- django_ninja_aio_crud-0.7.3.dist-info/WHEEL,sha256=_2ozNFCLWc93bK4WKHCO-eDUENDlo-dgc9cU3qokYO4,82
13
- django_ninja_aio_crud-0.7.3.dist-info/METADATA,sha256=m55Q0O1Eb9kzXkfpDzMncLsc3LPd-Wu8wqr4GlWet18,13759
14
- django_ninja_aio_crud-0.7.3.dist-info/RECORD,,
11
+ django_ninja_aio_crud-0.7.4.dist-info/licenses/LICENSE,sha256=yrDAYcm0gRp_Qyzo3GQa4BjYjWRkAhGC8QRva__RYq0,1073
12
+ django_ninja_aio_crud-0.7.4.dist-info/WHEEL,sha256=_2ozNFCLWc93bK4WKHCO-eDUENDlo-dgc9cU3qokYO4,82
13
+ django_ninja_aio_crud-0.7.4.dist-info/METADATA,sha256=ZjawRtUD5hMHi_u0klFeVtu8BXXzqgRph-5TELJ1_OQ,13759
14
+ django_ninja_aio_crud-0.7.4.dist-info/RECORD,,
ninja_aio/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Django Ninja AIO CRUD - Rest Framework"""
2
2
 
3
- __version__ = "0.7.3"
3
+ __version__ = "0.7.4"
4
4
 
5
5
  from .api import NinjaAIO
6
6
 
ninja_aio/models.py CHANGED
@@ -348,9 +348,9 @@ class ModelSerializer(models.Model, metaclass=ModelSerializerMeta):
348
348
  @classmethod
349
349
  def get_related_schema_data(cls):
350
350
  fields = cls.get_fields("read")
351
- custom_f = [f[0] for f in cls.get_custom_fields("read")]
352
- related_fields = []
353
- for f in fields + custom_f:
351
+ custom_f = {name: (value, default) for name, value, default in cls.get_custom_fields("read")}
352
+ _related_fields = []
353
+ for f in fields + list(custom_f.keys()):
354
354
  field_obj = getattr(cls, f)
355
355
  if not isinstance(
356
356
  field_obj,
@@ -362,18 +362,14 @@ class ModelSerializer(models.Model, metaclass=ModelSerializerMeta):
362
362
  ForwardOneToOneDescriptor,
363
363
  ),
364
364
  ):
365
- related_fields.append(f)
365
+ _related_fields.append(f)
366
366
 
367
- if not related_fields:
367
+ if not _related_fields:
368
368
  return None, None
369
369
 
370
- custom_related_fields = []
371
- for f in related_fields:
372
- for custom in cls.get_custom_fields("read"):
373
- if f == custom[0]:
374
- custom_related_fields.append(custom)
375
- related_fields.remove(f)
376
-
370
+
371
+ custom_related_fields = [(f, *custom_f[f]) for f in _related_fields if f in custom_f]
372
+ related_fields = [f for f in _related_fields if f not in custom_f]
377
373
  return related_fields, custom_related_fields
378
374
 
379
375
  @classmethod