You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/guides/response/django-pydantic.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -5,15 +5,15 @@ Schemas are very useful to define your validation rules and responses, but somet
5
5
6
6
## ModelSchema
7
7
8
-
`ModelSchema` is a special base class that can automatically generate schemas from your models. Under the hood it converts your models Django fields into
9
-
pydantic type annotations. `ModelSchema` inherits from `Schema`, and is just a `Schema` with a Django field -> pydantic field conversion step. All other `Schema`
8
+
`ModelSchema` is a special base class that can automatically generate schemas from your models. Under the hood it converts your Django`Model` fields into
9
+
type annotations. `ModelSchema` inherits from `Schema`, and is just a `Schema` with a Django field to pydantic field conversion step. All other `Schema`
10
10
related configuration and inheritance is the same.
11
11
12
12
### Configuration
13
13
14
14
To configure a `ModelSchema` you define a `Meta` class attribute just like in Django. This `Meta` class will be validated by `ninja.orm.metaclass.MetaConf`.
15
15
16
-
```Python
16
+
```
17
17
class MetaConf: # summary
18
18
model: Django model being used to create the Schema
19
19
fields: List of field names in the model to use. Defaults to '__all__' which includes all fields
@@ -45,9 +45,9 @@ class UserSchema(ModelSchema):
45
45
46
46
### Non-Django Model Configuration
47
47
48
-
The `Meta`classis only used for configuring the interaction between the django modeland the underlying
49
-
`Schema`. To configure the pydantic model underlying the `Schema`define,`model_config`in your
50
-
`ModelSchema`class,or [use the deprecated by pydantic `class Config`](https://docs.pydantic.dev/latest/concepts/config/).
48
+
The `Meta` class is only used for configuring the interaction between the Django `Model` and the underlying
49
+
`Schema`. To configure the pydantic model underlying the `Schema`, [define `model_config`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_config)
50
+
in your `ModelSchema` class or [use the deprecated \(by pydantic\)`class Config`](https://docs.pydantic.dev/latest/concepts/config/).
0 commit comments