django-ninja-aio-crud 0.8.3__tar.gz → 0.8.4__tar.gz
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.
- {django_ninja_aio_crud-0.8.3 → django_ninja_aio_crud-0.8.4}/PKG-INFO +1 -1
- {django_ninja_aio_crud-0.8.3 → django_ninja_aio_crud-0.8.4}/ninja_aio/__init__.py +1 -1
- {django_ninja_aio_crud-0.8.3 → django_ninja_aio_crud-0.8.4}/ninja_aio/views.py +14 -9
- {django_ninja_aio_crud-0.8.3 → django_ninja_aio_crud-0.8.4}/LICENSE +0 -0
- {django_ninja_aio_crud-0.8.3 → django_ninja_aio_crud-0.8.4}/README.md +0 -0
- {django_ninja_aio_crud-0.8.3 → django_ninja_aio_crud-0.8.4}/ninja_aio/api.py +0 -0
- {django_ninja_aio_crud-0.8.3 → django_ninja_aio_crud-0.8.4}/ninja_aio/auth.py +0 -0
- {django_ninja_aio_crud-0.8.3 → django_ninja_aio_crud-0.8.4}/ninja_aio/exceptions.py +0 -0
- {django_ninja_aio_crud-0.8.3 → django_ninja_aio_crud-0.8.4}/ninja_aio/models.py +0 -0
- {django_ninja_aio_crud-0.8.3 → django_ninja_aio_crud-0.8.4}/ninja_aio/parsers.py +0 -0
- {django_ninja_aio_crud-0.8.3 → django_ninja_aio_crud-0.8.4}/ninja_aio/renders.py +0 -0
- {django_ninja_aio_crud-0.8.3 → django_ninja_aio_crud-0.8.4}/ninja_aio/schemas.py +0 -0
- {django_ninja_aio_crud-0.8.3 → django_ninja_aio_crud-0.8.4}/ninja_aio/types.py +0 -0
- {django_ninja_aio_crud-0.8.3 → django_ninja_aio_crud-0.8.4}/pyproject.toml +0 -0
|
@@ -87,7 +87,9 @@ class APIViewSet:
|
|
|
87
87
|
self.schema_out, self.schema_in, self.schema_update = self.get_schemas()
|
|
88
88
|
self.path_schema = self._generate_path_schema()
|
|
89
89
|
self.filters_schema = self._generate_filters_schema()
|
|
90
|
-
self.router_tag =
|
|
90
|
+
self.router_tag = " ".join(
|
|
91
|
+
self.model._meta.verbose_name.capitalize().split(" ")
|
|
92
|
+
)
|
|
91
93
|
self.router = Router(tags=[self.router_tag])
|
|
92
94
|
self.path = "/"
|
|
93
95
|
self.path_retrieve = f"{{{self.model_util.model_pk_name}}}/"
|
|
@@ -115,13 +117,13 @@ class APIViewSet:
|
|
|
115
117
|
|
|
116
118
|
def get_view_auth(self):
|
|
117
119
|
return self._auth_view("get")
|
|
118
|
-
|
|
120
|
+
|
|
119
121
|
def post_view_auth(self):
|
|
120
122
|
return self._auth_view("post")
|
|
121
|
-
|
|
123
|
+
|
|
122
124
|
def patch_view_auth(self):
|
|
123
125
|
return self._auth_view("patch")
|
|
124
|
-
|
|
126
|
+
|
|
125
127
|
def delete_view_auth(self):
|
|
126
128
|
return self._auth_view("delete")
|
|
127
129
|
|
|
@@ -164,7 +166,7 @@ class APIViewSet:
|
|
|
164
166
|
auth=self.post_view_auth(),
|
|
165
167
|
response={201: self.schema_out, self.error_codes: GenericMessageSchema},
|
|
166
168
|
)
|
|
167
|
-
async def create(request: HttpRequest, data: self.schema_in):
|
|
169
|
+
async def create(request: HttpRequest, data: self.schema_in): # type: ignore
|
|
168
170
|
return 201, await self.model_util.create_s(request, data, self.schema_out)
|
|
169
171
|
|
|
170
172
|
create.__name__ = f"create_{self.model_util.model_name}"
|
|
@@ -181,7 +183,8 @@ class APIViewSet:
|
|
|
181
183
|
)
|
|
182
184
|
@paginate(self.pagination_class)
|
|
183
185
|
async def list(
|
|
184
|
-
request: HttpRequest,
|
|
186
|
+
request: HttpRequest,
|
|
187
|
+
filters: Query[self.filters_schema] = None, # type: ignore
|
|
185
188
|
):
|
|
186
189
|
qs = self.model.objects.select_related()
|
|
187
190
|
if isinstance(self.model, ModelSerializerMeta):
|
|
@@ -206,7 +209,7 @@ class APIViewSet:
|
|
|
206
209
|
auth=self.get_view_auth(),
|
|
207
210
|
response={200: self.schema_out, self.error_codes: GenericMessageSchema},
|
|
208
211
|
)
|
|
209
|
-
async def retrieve(request: HttpRequest, pk: Path[self.path_schema]):
|
|
212
|
+
async def retrieve(request: HttpRequest, pk: Path[self.path_schema]): # type: ignore
|
|
210
213
|
obj = await self.model_util.get_object(request, self._get_pk(pk))
|
|
211
214
|
return await self.model_util.read_s(request, obj, self.schema_out)
|
|
212
215
|
|
|
@@ -220,7 +223,9 @@ class APIViewSet:
|
|
|
220
223
|
response={200: self.schema_out, self.error_codes: GenericMessageSchema},
|
|
221
224
|
)
|
|
222
225
|
async def update(
|
|
223
|
-
request: HttpRequest,
|
|
226
|
+
request: HttpRequest,
|
|
227
|
+
data: self.schema_update, # type: ignore
|
|
228
|
+
pk: Path[self.path_schema], # type: ignore
|
|
224
229
|
):
|
|
225
230
|
return await self.model_util.update_s(
|
|
226
231
|
request, data, self._get_pk(pk), self.schema_out
|
|
@@ -235,7 +240,7 @@ class APIViewSet:
|
|
|
235
240
|
auth=self.delete_view_auth(),
|
|
236
241
|
response={204: None, self.error_codes: GenericMessageSchema},
|
|
237
242
|
)
|
|
238
|
-
async def delete(request: HttpRequest, pk: Path[self.path_schema]):
|
|
243
|
+
async def delete(request: HttpRequest, pk: Path[self.path_schema]): # type: ignore
|
|
239
244
|
return 204, await self.model_util.delete_s(request, self._get_pk(pk))
|
|
240
245
|
|
|
241
246
|
delete.__name__ = f"delete_{self.model_util.model_name}"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|