Skip to content

Commit

Permalink
Merge 54822eb into 9fe90cc
Browse files Browse the repository at this point in the history
  • Loading branch information
jfinkels committed Oct 30, 2016
2 parents 9fe90cc + 54822eb commit 75351cd
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/fetching.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ following code on the server::

class Person(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.Unicode)

class Article(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.Unicode)
author_id = db.Column(db.Integer, db.ForeignKey('person.id'))
author = db.relationship(Person, backref=db.backref('articles'))

Expand Down Expand Up @@ -63,6 +65,9 @@ yields the response
{
"data": [
{
"attributes": {
"name": "John"
},
"id": "1",
"links": {
"self": "http://example.com/api/person/1"
Expand Down Expand Up @@ -108,6 +113,9 @@ yields the response

{
"data": {
"attributes": {
"name": "John"
},
"id": "1",
"links": {
"self": "http://example.com/api/person/1"
Expand Down Expand Up @@ -142,6 +150,9 @@ yields the response

{
"data": {
"attributes": {
"name": "John"
},
"id": "1",
"links": {
"self": "http://example.com/api/person/1"
Expand Down Expand Up @@ -182,6 +193,9 @@ yields the response
{
"data": [
{
"attributes": {
"title": "Once upon a time"
},
"id": "2",
"links": {
"self": "http://example.com/api/articles/2"
Expand Down Expand Up @@ -230,6 +244,9 @@ yields the response

{
"data": {
"attributes": {
"title": "Once upon a time"
},
"id": "2",
"links": {
"self": "http://example.com/api/articles/2"
Expand Down

0 comments on commit 75351cd

Please sign in to comment.