Skip to content

Commit 10a1b1b

Browse files
excluding first last from args
1 parent f26d023 commit 10a1b1b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

graphene_mongo/fields.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,14 @@ def fields(self):
8484
def get_query(cls, model, info, **args):
8585
objs = model.objects()
8686
if args:
87+
first = args.pop('first', None)
88+
last = args.pop('last', None)
8789
objs = objs.filter(**args)
8890

89-
if 'first' in args:
90-
objs = objs[:args['first']]
91-
if 'last' in args:
92-
objs = objs[:-args['last']]
91+
if first is not None:
92+
objs = objs[:first]
93+
if last is not None:
94+
objs = objs[:-last]
9395

9496
return objs
9597

0 commit comments

Comments
 (0)