Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/logical_data_abstraction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ Now let's create the logical abstraction to illustrate this concept.
related_view_kwargs={'id': '<id>'},
many=True,
schema='ComputerSchema',
type_='computer')
type_='computer',
id_field='computer_id')


class ComputerSchema(Schema):
Expand All @@ -81,6 +82,7 @@ First, take a look of Person compared to PersonSchema:

* we can see that Person has an attribute named "password" and we don't want to expose it through the api so it is not set in PersonSchema
* PersonSchema has an attribute named "display_name" that is the result of concatenation of name and email
* In the computers Relationship() defined on PersonSchema we have set the id_field to "computer_id" as that is the primary key on the Computer(db.model). Without seeting id_field the relationship looks for a field called "id".

Second, take a look of Computer compared to ComputerSchema:

Expand Down