Skip to content

Feat: Adding the option of importing interfaces from strings #423

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Hercilio1
Copy link

I want to add new interfaces to a Page model, but the problem is that those interfaces import model files to collect different sets of data from them.

The issue is that graphql_interfaces = [CustomInterface] requires importing CustomInterface inside the model file, which causes the error AppRegistryNotReady("Models aren't loaded yet.").

The load_type_fields runs at the right time, but I can’t define graphql_interfaces without importing the interface in the models file.

The fix would be something like graphql_interfaces = ["apps.custom.graphql.object_types.CustomInterface"], so I implemented it this way.

@zerolab
Copy link
Member

zerolab commented Mar 26, 2025

Thank you. Can you add a test or two?

@Hercilio1
Copy link
Author

@zerolab , done :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants