-
Notifications
You must be signed in to change notification settings - Fork 822
relay.Connection class cannot declare my own Paginator #573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The reason I need to use the django Paginator with the connection is because if i slice the queryset in the resolver for that ConnectionField than the connection field will not know that it has already been sliced, the list, and it will try to slice the list again in the slice method, and the pageinfo in the connection will be wrong. Also PageInfo isn't really a page info more like a slice info. |
**Well I did it 😄 **
and this is what I get back
|
@japrogramer |
shure, I have a few extra stuff related to my implementation, here is the meat and potatoes of it tho simplified to work with your example here is a quick example.
|
Im working with a connection Class of this shape:
The problem is that I want to use django own queryset paginator to resolve the list that gets passed by the resolve for where the connection is used.
my query looks like
I would Like to mak my own PageInfo class that has the attributes that can be returned by djangos Paginator class like
and also the methods for each pages most notably has_next has_previous
https://docs.djangoproject.com/en/1.11/topics/pagination/#page-objects
In order to do that I need to be able to control how
def connection_from_list_slice(...)
resolves for PageInfo and for that matter the nodes, which means that I will need to change this line to call my own methodgraphene/graphene/relay/connection.py
Line 122 in c38ffa5
Simplest way to do that is to create a subclass of the ConnectionField and override the
def resolve_connection
method.well looks like I just found a path to a solution to my own problem. Going to post to see if anyone has anything to ask or add, also might comeback to this issue if I find any more problems or difficult behavior I don't know how to implement while trying to work this out.
The text was updated successfully, but these errors were encountered: