Для модели не зарегистрирован тип:

Когда я запускаю сервер и перехожу к GraphQL API. Он показывает мне исключение -

Для модели не зарегистрирован тип: UserAgreementAssociation.

Кто-то посоветует?

mutations.py

from graphene_django.forms.mutation import DjangoModelFormMutation
 
from agreement.forms import UserAgreementAssociationForm,  


class CreateUserAgreementAssociationMutation(DjangoModelFormMutation):
    class Meta:
        form_class = UserAgreementAssociationForm

forms.py

from django import forms

from agreement.models import UserAgreementAssociation


class UserAgreementAssociationForm(forms.ModelForm):
    class Meta:
        model = UserAgreementAssociation
        fields = ('user', 'agreement', 'active',)

models.py

class UserAgreementAssociation(models.Model):
    user = models.ForeignKey(User , related_name='user_associations', on_delete=models.CASCADE)
    agreement = models.ForeignKey(BaseAgreement, related_name='agreement_associations', on_delete=models.CASCADE)
    active = models.BooleanField(default=True)
    date_create = models.DateTimeField(auto_now_add=True, editable=False, blank=True)

    def __str__(self):
        return f'{self.date_create}/{self.user}/{self.agreement}'
Вернуться на верх