Skip to content

Support for Proxy Models #319

Closed
Closed
@jm2242

Description

@jm2242

Is there support for querying proxy models? I'm trying to query a model that has a bunch of proxy models but am getting an error. Here's an abbreviated look at my setup:

class Column:
...

class FieldColumn(Column):
  proxy=True
class Query(graphene.ObjecType):
    column = graphene.Field(ColumnType)
    all_columns = DjangoFilterConnectionField(ColumnType)

and

class ColumnType(DjangoObjectType):
    class Meta:
        model = Column
        filter_fields = ['sheet__name', 'name']
        interfaces = (relay.Node, )
        exclude_fields = [  
            'legislation_type', 'project_stat_type', ... # weirdly have to exclude these fields because the 'type' in the variable name makes the field introspector sad
        ]

my query is:

query {
	allColumns(sheet_Name:"Simple Sheet") {
		edges {
      node{
        id, name
      }
    }
  }
}

Here's the trace:

Traceback (most recent call last):
  File "/Users/jonathanmares/.virtualenvs/quorum/lib/python2.7/site-packages/promise/promise.py", line 65, in try_catch
    return (handler(*args, **kwargs), None)
  File "/Users/jonathanmares/.virtualenvs/quorum/lib/python2.7/site-packages/graphql/execution/executor.py", line 375, in <lambda>
    resolved
  File "/Users/jonathanmares/.virtualenvs/quorum/lib/python2.7/site-packages/graphql/execution/executor.py", line 405, in complete_value
    return complete_object_value(exe_context, return_type, field_asts, info, result)
  File "/Users/jonathanmares/.virtualenvs/quorum/lib/python2.7/site-packages/graphql/execution/executor.py", line 499, in complete_object_value
    field_asts
graphql.error.base.GraphQLError: Expected value of type "ColumnType" but got: FieldColumn.

I know this PR https://github.com/graphql-python/graphene-django/pull/156/files is waiting to be merged, but I tried running my query with the proposed changes and still get the same error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions