Skip to content

Commit

Permalink
django Variable instead of attrgetter
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalik committed Feb 3, 2022
1 parent 859005f commit c967d05
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/docs/tutorial/response-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,18 @@ class TaskSchema(Schema):
owner_first_name: str = Field(None, alias="owner.first_name")
```

Aliases also supprt django template syntax variables access:

```Python hl_lines="2"
class TaskSchema(Schema):
last_message: str = Field(None, alias="message_set.0.text")
```

```Python hl_lines="3"
class TaskSchema(Schema):
type: str = Field(None)
type_display: str = Field(None, alias="get_type_dispaly") # callable will be executed
```

## Resolvers

Expand Down

0 comments on commit c967d05

Please sign in to comment.