graphene-django-extras
graphene-django-extras copied to clipboard
ForeignKey name issue which makes it not appear in the type
With this models:
class ProductionCompany(models.Model):
name = models.CharField(max_length=200)
class Movie(models.Model):
title = models.CharField(max_length=200)
production_company = models.ForeignKey(ProductionCompany, related_name="movies", null=True, blank=True, on_delete=models.CASCADE)
and these types:
class ProductionCompanyType(DjangoObjectType):
class Meta:
model = ProductionCompany
class MovieListType(DjangoListObjectType):
class Meta:
model = Movie
pagination = LimitOffsetGraphqlPagination(default_limit=25,
ordering="id") # ordering can be: string, tuple or list
MovieGenericType
generated by MovieListType
doesn't contain productionCompany
(foreign key) field
I think this issue happens in the registry.py line 45
:
where the key used to find the model in the registry is productioncompany
(and then camelCased) and instead it expects productionCompany
So somewhere up the stack the field production_company
of the model Movie
is changed to become that erroneous key
Unfortunately I don't understand the whole run sequence very well so I don't know where this happens.