Skip to content

Conversation

alexpantyukhin
Copy link
Contributor

No description provided.

@abawchen
Copy link
Collaborator

abawchen commented Feb 9, 2018

@alexpantyukhin 👍

It turns out that I make things complicated :<
The errors raised just because first/last can't be passed into filter: objs = objs.filter(**args) -- maybe:

objs = model.objects()

if args:
    first = args.pop('first', None)
    last = args.pop('last', None)
    objs = objs.filter(**args)

    if first is not None:
        objs = objs[:first]
    if last is not None:
        objs = objs[:-last]

return objs       

but it's untidy. Any thought?

@alexpantyukhin
Copy link
Contributor Author

@abawchen Yes! I think you are right about excluding first and args from params.
For my view: maybe for the first it's would be untidy, but it's clear for reading.
For TODO there could be some filter of params which filters only fields which are in the Model.
What do you think about it?

@abawchen abawchen merged commit e5b0d82 into graphql-python:master Feb 11, 2018
arunsureshkumar pushed a commit to arunsureshkumar/graphene-mongo that referenced this pull request Nov 2, 2020
abhinand-c referenced this pull request in strollby/graphene-mongo Jun 12, 2023
abhinand-c referenced this pull request in strollby/graphene-mongo Jun 12, 2023
Co-authored-by: Laurent Riviere <laurent@loftorbital.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants