Skip to content

Nodes shorthand and totalCount in DjangoFilterConnectionField #1322

Answered by everdrone
everdrone asked this question in Q&A
Discussion options

You must be logged in to vote

Found a very hacky workaround for anyone interested, this patch works for

  • graphene==2.1.9
  • graphql-relay==2.0.1
  • graphene-django==2.15.0

You'll need to patch the packages after install.

--- site-packages/graphql_relay/connection/connectiontypes.py	2022-05-21 14:17:29.000000000 +0200
+++ site-packages/graphql_relay/connection/connectiontypes.py	2022-05-21 14:17:17.000000000 +0200
@@ -1,13 +1,17 @@
 class Connection(object):

-    def __init__(self, edges, page_info):
+    def __init__(self, edges, page_info, nodes, total_count):
         self.edges = edges
         self.page_info = page_info
+        self.nodes = nodes
+        self.total_count = total_count

     def to_dict(self):
      …

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by everdrone
Comment options

You must be logged in to vote
2 replies
@everdrone
Comment options

@nicolalandro
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants