Skip to content

Commit

Permalink
Pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
Omar Diaz committed Jul 14, 2017
1 parent d1d3f95 commit 67469a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*.egg-info/
.cache/
__pycache__/
/.idea/
/.idea/
14 changes: 4 additions & 10 deletions carbon14/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _resolve(
ctx,
ids=None,
limit=None,
offset=None,
offset=0,
**kwargs
):
if self._auth_required and not ctx.user.is_authenticated():
Expand All @@ -60,16 +60,10 @@ def _resolve(
if ids is not None:
instances = instances.filter(id__in=ids)

instances = instances.all()
instances = instances.all()[offset:]

if limit and offset:
instances = instances[offset:offset + limit]

if offset and not limit:
instances = instances[offset:]

if limit and not offset:
instances = instances[0:limit]
if limit:
instances = instances[:limit]

return instances

Expand Down

0 comments on commit 67469a6

Please sign in to comment.