Closed ruisaraiva19 closed 3 years ago
I'm having an issue with the GraphQLPage grapple model. It always returns the Wagtail core Page.
GraphQLPage
Page
I have a snippet with a page property that links to any Wagtail page.
page
@register_snippet @register_query_field('Ad', 'Ads') class Ad(models.Model): title = models.CharField( max_length=20, blank=False, default="", ) page = models.ForeignKey( "wagtailcore.Page", null=True, blank=True, ) panels = [ FieldPanel("title"), PageChooserPanel("page"), ] graphql_fields = [ GraphQLString("title"), GraphQLPage("page"), ]
But when I run the query on GraphiQL, always resolves with the wagtailcore.Page as the contentType.
wagtailcore.Page
contentType
Query:
{ Ads { page { id __typename contentType } } }
Response:
{ "data": { "Ads": [ { "page": { "id": "21", "__typename": "Page", "contentType": "wagtailcore.Page" } } ] } }
I was expecting something like what I get when running the following for the same page.
{ page(id: 21) { id __typename contentType } }
{ "data": { "page": { "id": "21", "__typename": "Article", "contentType": "news.Article" } } }
fixed in 37211857c7b5a1409bfc7b1dcb8320de558d85d8
🐛 Bug Report
I'm having an issue with the
GraphQLPage
grapple model. It always returns the Wagtail corePage
.💻 Code Sample
I have a snippet with a
page
property that links to any Wagtail page.😯 Current Behavior
But when I run the query on GraphiQL, always resolves with the
wagtailcore.Page
as thecontentType
.Query:
Response:
🤔 Expected Behavior
I was expecting something like what I get when running the following for the same page.
Query:
Response: