django-ninja-aio-crud 0.2.1__py3-none-any.whl → 0.2.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-ninja-aio-crud
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Django Ninja AIO CRUD - Rest Framework
5
5
  Author: Giuseppe Casillo
6
6
  Requires-Python: >=3.10
@@ -1,12 +1,12 @@
1
- ninja_aio/__init__.py,sha256=wVH_cPllWb0Bdyr7atTEbTJxhDdYsDjbn1CVCeB_e60,120
1
+ ninja_aio/__init__.py,sha256=j1Bp3GY1eYMxYEIv5dpP2Yj2BTv3Jn7ZnNjblltWvf8,120
2
2
  ninja_aio/api.py,sha256=qEnCOvviJGfg28N9R2XWzykLGOFpJ0JMqe3rm4AYDkM,1564
3
3
  ninja_aio/auth.py,sha256=hGgiblvffpHmmakjaxdNT3G0tq39-Bvc5oLNqjn4qd8,1300
4
4
  ninja_aio/exceptions.py,sha256=PPNr1CdC7M7Kx1MtiBGuR4hATYQqEuvxCRU6uSG7rgM,543
5
- ninja_aio/models.py,sha256=xUZ0998bYkWumwZgnVC7P-CLdbfTzFflmJVbusU2UMY,11276
5
+ ninja_aio/models.py,sha256=5BIgW6U8Ghlfmkssg6zgSinTgOBwgSss-QkiyJUiM9I,11251
6
6
  ninja_aio/parsers.py,sha256=e_4lGCPV7zs-HTqtdJTc8yQD2KPAn9njbL8nF_Mmgkc,153
7
7
  ninja_aio/renders.py,sha256=wLQisbIsMJlGYJMO4Ud-qiaVCvz4yxiZ4mYommixAeQ,1453
8
8
  ninja_aio/schemas.py,sha256=EgRkfhnzZqwGvdBmqlZixMtMcoD1ZxV_qzJ3fmaAy20,113
9
9
  ninja_aio/views.py,sha256=ejn6adCe91YKo0-0bRePbuARHkz8YWMmP54WxQLLqxY,6322
10
- django_ninja_aio_crud-0.2.1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
11
- django_ninja_aio_crud-0.2.1.dist-info/METADATA,sha256=cB1AOW4xZ0DLUpgMAF6AMJVYP48aKy3xQZowVsFWP0g,10135
12
- django_ninja_aio_crud-0.2.1.dist-info/RECORD,,
10
+ django_ninja_aio_crud-0.2.2.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
11
+ django_ninja_aio_crud-0.2.2.dist-info/METADATA,sha256=hwRXbOz9QBLTuamrso72d1SW4HmKFw7UEmuEHqQS8xc,10135
12
+ django_ninja_aio_crud-0.2.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__ = "0.2.1"
3
+ __version__ = "0.2.2"
4
4
 
5
5
  from .api import NinjaAIO
6
6
 
ninja_aio/models.py CHANGED
@@ -182,12 +182,9 @@ class ModelSerializer(models.Model):
182
182
  except Exception as exc:
183
183
  raise SerializeError({k: ". ".join(exc.args)}, 400)
184
184
  if isinstance(field_obj, models.ForeignKey):
185
- try:
186
- rel: ModelSerializer = await field_obj.related_model.get_object(
187
- request, v
188
- )
189
- except ObjectDoesNotExist:
190
- raise SerializeError({k: "not found"}, 404)
185
+ rel: ModelSerializer = await field_obj.related_model.get_object(
186
+ request, v
187
+ )
191
188
  payload |= {k: rel}
192
189
  new_payload = {k: v for k, v in payload.items() if k not in customs}
193
190
  return new_payload, customs
@@ -292,7 +289,11 @@ class ModelSerializer(models.Model):
292
289
  @classmethod
293
290
  async def read_s(cls, request: HttpRequest, obj: type["ModelSerializer"]):
294
291
  schema = cls.generate_read_s().from_orm(obj)
295
- return await cls.parse_output_data(request, schema)
292
+ try:
293
+ data = await cls.parse_output_data(request, schema)
294
+ except SerializeError as e:
295
+ return e.status_code, e.error
296
+ return data
296
297
 
297
298
  @classmethod
298
299
  async def update_s(cls, request: HttpRequest, data: Schema, pk: int | str):