From 167d0a396442dfb6f3cc636123d7e69d4c42d220 Mon Sep 17 00:00:00 2001 From: mongkok Date: Mon, 22 Jan 2018 01:03:52 +0530 Subject: [PATCH] Allow DjangoObjectType to have default _meta --- graphene_django/types.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/graphene_django/types.py b/graphene_django/types.py index 684863a..54ed87b 100644 --- a/graphene_django/types.py +++ b/graphene_django/types.py @@ -45,7 +45,7 @@ class DjangoObjectType(ObjectType): @classmethod def __init_subclass_with_meta__(cls, model=None, registry=None, skip_registry=False, only_fields=(), exclude_fields=(), filter_fields=None, connection=None, - connection_class=None, use_connection=None, interfaces=(), **options): + connection_class=None, use_connection=None, interfaces=(), _meta=None, **options): assert is_valid_django_model(model), ( 'You need to pass a valid Django Model in {}.Meta, received "{}".' ).format(cls.__name__, model) @@ -82,7 +82,9 @@ class DjangoObjectType(ObjectType): "The connection must be a Connection. Received {}" ).format(connection.__name__) - _meta = DjangoObjectTypeOptions(cls) + if not _meta: + _meta = DjangoObjectTypeOptions(cls) + _meta.model = model _meta.registry = registry _meta.filter_fields = filter_fields