Skip to content

Commit 368224f

Browse files
author
Kiptoo Magutt
committed
add detail, list resources, and URL routes for person_tags
- to allow testing nested fields in schema
1 parent b4cb557 commit 368224f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

examples/api_nested.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,15 @@ class PersonRelationship(ResourceRelationship):
144144
data_layer = {'session': db.session,
145145
'model': Person}
146146

147+
class PersonTagList(ResourceList):
148+
schema = PersonTagSchema
149+
data_layer = {'session': db.session,
150+
'model': Person_Tag}
151+
152+
class PersonTagDetail(ResourceDetail):
153+
schema = PersonTagSchema
154+
data_layer = {'session': db.session,
155+
'model': Person_Tag}
147156

148157
class ComputerList(ResourceList):
149158
def query(self, view_kwargs):
@@ -190,6 +199,9 @@ class ComputerRelationship(ResourceRelationship):
190199
api.route(ComputerDetail, 'computer_detail', '/computers/<int:id>')
191200
api.route(ComputerRelationship, 'computer_person', '/computers/<int:id>/relationships/owner')
192201

202+
api.route(PersonTagList, 'person_tag_list', '/persontags')
203+
api.route(PersonTagDetail, 'person_tag_detail', '/persontags/<int:id>')
204+
193205
if __name__ == '__main__':
194206
# Start application
195207
app.run(debug=True)

0 commit comments

Comments
 (0)