M2M connection is broken
See original GitHub issueHi,
I have following models:
class Place(models.Model):
categories = models.ManyToManyField(PlaceCategory, related_name='places')
class PlaceCategory(models.Model):
name = models.CharField(max_length=255, unique=True)
Furthermore, I have following DjangoObjectType models:
class PlaceNode(DjangoObjectType):
class Meta:
model = Place
interfaces = (graphene.relay.Node, )
class PlaceCategoryNode(DjangoObjectType):
class Meta:
model = PlaceCategory
interfaces = (graphene.relay.Node, )
Then when I execute this query:
{
placeCategories {
edges {
node {
id
places {
edges {
node {
id
}
}
}
}
}
}
}
everything works great but when I try to execute this one:
{
places {
edges {
node {
id
categories {
edges {
node {
id
}
}
}
}
}
}
}
I get errors:
Cannot combine queries on two different base models.
It seems that M2M connection is working improperly and it is unable to fetch related objects from instance where M2M is defined.
Has anyone run into the same problem ?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:8 (2 by maintainers)
Top Results From Across the Web
M2M (Machine To Machine) Is Broken: And How To Fix It?
Sounds great, right? Well, there are some pieces of this M2M vision that, currently broken, need to be fixed for M2M to work...
Read more >SIM is not working - Global M2M SIM Support - Zendesk
If your SIM is connecting to the network OK but not making a data connection, check that the correct Access Point Name (APN)...
Read more >The challenges of M2M massive access in wireless cellular ...
The basic idea is to offload the network by exploiting the physical proximity of the terminals, e.g., enabling direct communication between user devices,...
Read more >M2M application characteristics and their implications ... - Ofcom
This purpose of this study was to assess the potential implications for radio spectrum of growing demand for machine to machine (M2M) ...
Read more >Breaking a Lightweight M2M Authentication Protocol for ...
Generally, a smart sensor is a resource-constrained device which is responsible for gathering data from the monitored area. Machine-to-Machine (M2M) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can just define custom resolver and return queryset. It should work.
In my case it would be:
But this is only a workaround. In my case when I have lots of M2M it is annoying that I have to define custom resolvers for all of them.
@keremgocen No, this was not merged in time for the 1.3 release. There has not been a new release to pypi since this was merged. From the commit log, it looks like a release is pushed about every month or so, so I don’t expect it will be too long.
In the meantime, you can pull down master instead of 1.3.
pip uninstall graphene-django
pip install git+https://github.com/graphql-python/graphene-django.git
or in requirements.txt
pip install git+ssh://git@github.com/graphql-python/graphene-django.git#egg=graphene-django