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

No type registered for model: <model> #186

Open
lautarodapin opened this issue Aug 1, 2022 · 0 comments
Open

No type registered for model: <model> #186

lautarodapin opened this issue Aug 1, 2022 · 0 comments

Comments

@lautarodapin
Copy link

I had an issue that i can't fix.
I'm trying to use this package together with graphene-django defining types with the extra package and using DjangoModelFormMutation from the graphene-django package. But for some reason the types that I register using the extras class are not present for the other package.

image

Here is an example

# models.py
class Category(models.Model):
    name = models.CharField(max_length=16)

# forms.py
from django import forms
from graphene_django.forms.mutation import DjangoModelFormMutation

class CategoryForm(forms.ModelForm):
   class Meta:
        model = Category
        fields = ['name']

# schema.py
import graphene
from graphene_django_extras import DjangoObjectType
from .models import Category
from .forms import CategoryForm

class CategoryType(DjangoObjectType):
    class Meta:
        model = Category

class CreateCategoryMutation(DjangoModelFormMutation):
    class Meta:
        form_class = CategoryForm       # <----- For some reason `CategoryType` is not register for the graphene_django package


class Mutation(graphene.Mutation):
     create_category = CreateCategoryMutation.Field()
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