Skip to content

related object pagination  #6

Description

It is not very clear how to server large numbers of related objects as is obvious they cannot be loaded explicitely in relation json-api/json-api#1120

One way I thouht was to just set emtpy data=[] and serve just link to the relation so user can access different relation view as usual collection view.

"relationships": {
  ...
  "comments": {
    "links": {
      "self": "http://example.com/articles/1/relationships/comments",
      "related": "http://example.com/articles/1/comments"
    },
    "data": [ ]
  }
}

The only way to do it is:

myobj = s.get('myobj', '1234').resource
for ch in myobj.children:
    for r in s.iterate("myobjs/%s/children" % (ch.id)):
        print(".  ", r.id, r.some_field)

is there an plan to support relation iterator?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions