Skip to content
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

Question: How to refer to type created by decorator (e.g. register_query_field) #398

Open
PeterDekkers opened this issue Jul 10, 2024 · 0 comments

Comments

@PeterDekkers
Copy link

PeterDekkers commented Jul 10, 2024

Hello there. I'm wondering how to refer to a (GraphQL) type that was created by one of the decorators, e.g. by register_query_field.

Example

@register_query_field("my_page")
class MyPage(Page):
    pass

How do I e.g. set up a QuerySetList field on another model that references MyPage?

This used to work:

my_pages = QuerySetList(graphene.NonNull(registry.pages.get(MyPage)))

However, since updating from 0.19.2 to 0.26.0, registry.pages is empty when this runs. And it always felt a little weird, having to consult the registry like this.

Is there a better way? Thank you!

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

No branches or pull requests

1 participant