|
1 | 1 | # **Model APIController** |
| 2 | +Model Controllers dynamically creates **CRUD** operations for a **Django ORM** model in a controller based on some configurations. |
| 3 | + |
2 | 4 | Model Controllers extend the `ControllerBase` class and introduce two configuration variables, namely `model_config` and `model_service`. |
3 | 5 |
|
4 | | -The `model_config` is responsible for defining configurations related to routes and schema generation, while the `model_service` refers to a class that manages CRUD (Create, Read, Update, Delete) operations for the specified model. |
| 6 | +- `model_config` is responsible for defining configurations related to routes and schema generation |
| 7 | +- `model_service` refers to a class that manages CRUD (Create, Read, Update, Delete) operations for the specified model. |
5 | 8 |
|
6 | 9 | For example, consider the definition of an `Event` model in Django: |
7 | 10 |
|
@@ -369,7 +372,7 @@ In the above illustration, we created `add_event_to_new_category` as an asynchro |
369 | 372 | `handle_add_event_to_new_category` to asynchronous function as well. |
370 | 373 |
|
371 | 374 |
|
372 | | -### **QueryGetter and ObjectGetter** |
| 375 | +## **QueryGetter and ObjectGetter** |
373 | 376 | `ModelEndpointFactory` exposes a more flexible way to get a model object or get a queryset filter in the case of |
374 | 377 | `ModelEndpointFactory.find_one` and `ModelEndpointFactory.list`, respectively. |
375 | 378 |
|
@@ -436,7 +439,7 @@ Note that our `queryset_getter` may fail if an invalid ID is supplied, as this i |
436 | 439 | Also, keep in mind that `model_config` settings like `create_schema`, `retrieve_schema`, `patch_schema`, and `update_schema` |
437 | 440 | are all available after ModelConfig instantiation. |
438 | 441 |
|
439 | | -### **Path and Query Parameters** |
| 442 | +## **Path and Query Parameters** |
440 | 443 |
|
441 | 444 | In `ModelEndpointFactory`, path parameters are parsed to identify both `path` and `query` parameters. |
442 | 445 | These parameters are then created as fields within the Ninja input schema and resolved during the request, |
|
0 commit comments