Skip to content

Commit 167d0a3

Browse files
author
mongkok
committed
Allow DjangoObjectType to have default _meta
1 parent e05f069 commit 167d0a3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

graphene_django/types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class DjangoObjectType(ObjectType):
4545
@classmethod
4646
def __init_subclass_with_meta__(cls, model=None, registry=None, skip_registry=False,
4747
only_fields=(), exclude_fields=(), filter_fields=None, connection=None,
48-
connection_class=None, use_connection=None, interfaces=(), **options):
48+
connection_class=None, use_connection=None, interfaces=(), _meta=None, **options):
4949
assert is_valid_django_model(model), (
5050
'You need to pass a valid Django Model in {}.Meta, received "{}".'
5151
).format(cls.__name__, model)
@@ -82,7 +82,9 @@ def __init_subclass_with_meta__(cls, model=None, registry=None, skip_registry=Fa
8282
"The connection must be a Connection. Received {}"
8383
).format(connection.__name__)
8484

85-
_meta = DjangoObjectTypeOptions(cls)
85+
if not _meta:
86+
_meta = DjangoObjectTypeOptions(cls)
87+
8688
_meta.model = model
8789
_meta.registry = registry
8890
_meta.filter_fields = filter_fields

0 commit comments

Comments
 (0)