Skip to content

Commit

Permalink
Update documentation in main readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-s committed Jun 11, 2024
1 parent 274b284 commit 4d39eac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ See https://pydantic-docs.helpmanual.io/usage/models/ for more.

### Loading and exporting model instances

Use the `from_orm` method on the model schema to load a Django model instance for <a href="https://pydantic-docs.helpmanual.io/usage/exporting_models/">export</a>:
Use the `from_django` method on the model schema to load a Django model instance for <a href="https://pydantic-docs.helpmanual.io/usage/exporting_models/">export</a>:

```python
user = User.objects.create(
Expand All @@ -81,7 +81,7 @@ user = User.objects.create(
email="jordan@eremieff.com"
)

user_schema = UserSchema.from_orm(user)
user_schema = UserSchema.from_django(user)
print(user_schema.json(indent=2))
```

Expand Down Expand Up @@ -176,7 +176,7 @@ Now let's assume you're interested in exporting the order and profile informatio

```python
user = OrderUser.objects.first()
print(OrderUserSchema.from_orm(user).json(ident=4))
print(OrderUserSchema.from_django(user).json(ident=4))
```

**Output:**
Expand Down
1 change: 1 addition & 0 deletions djantic/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ def get_field_names(cls) -> List[str]:

@classmethod
def from_orm(cls, *args, **kwargs):
"""Considered deprecated, use from django instead"""
return cls.from_django(*args, **kwargs)

@classmethod
Expand Down

0 comments on commit 4d39eac

Please sign in to comment.