alainburindi / graphene_generator

A Graphene-Django (GraphQL) queries and mutations generator
MIT License
9 stars 0 forks source link

Multiple models #1

Open bastianhilton opened 3 years ago

bastianhilton commented 3 years ago

Hello, you mentioned in the Readme.md that you can add multiple models. Do you have an example of how to do this, because i have alot of models for a fairly large application.

alainburindi commented 3 years ago

Hey @bastianhilton GRAPHENE_GENERATOR_MODELS is a list that allows having as many models as possible

    GRAPHENE_GENERATOR_MODELS = [
        {
            'name': 'firstModel',
            'path': 'path.to.the.model',
        },
       {
            'name': 'secondModel',
            'path': 'path.to.the.model',
        },
       #other models
    ]

Can you try this?

bastianhilton commented 3 years ago

thank you, it works. Another question Does this generator run when the application runs with runserver or is there a specific command I need to run?

alainburindi commented 3 years ago

thank you, it works. Another question Does this generator run when the application runs with runserver or is there a specific command I need to run?

It generates the needed implementation when you import QueriesHolder or MutationsHolder

So based on the example in the doc it will run when setting up the graphene schema

bastianhilton commented 3 years ago

sorry to bother you but i'm still lost because its not generating the mutations and queries, https://github.com/bastianhilton/Alternate-CMS