mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-29 04:53:43 +03:00
Allow DjangoObjectType to have default _meta
This commit is contained in:
parent
e05f069b3b
commit
167d0a3964
|
@ -45,7 +45,7 @@ class DjangoObjectType(ObjectType):
|
||||||
@classmethod
|
@classmethod
|
||||||
def __init_subclass_with_meta__(cls, model=None, registry=None, skip_registry=False,
|
def __init_subclass_with_meta__(cls, model=None, registry=None, skip_registry=False,
|
||||||
only_fields=(), exclude_fields=(), filter_fields=None, connection=None,
|
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), (
|
assert is_valid_django_model(model), (
|
||||||
'You need to pass a valid Django Model in {}.Meta, received "{}".'
|
'You need to pass a valid Django Model in {}.Meta, received "{}".'
|
||||||
).format(cls.__name__, model)
|
).format(cls.__name__, model)
|
||||||
|
@ -82,7 +82,9 @@ class DjangoObjectType(ObjectType):
|
||||||
"The connection must be a Connection. Received {}"
|
"The connection must be a Connection. Received {}"
|
||||||
).format(connection.__name__)
|
).format(connection.__name__)
|
||||||
|
|
||||||
_meta = DjangoObjectTypeOptions(cls)
|
if not _meta:
|
||||||
|
_meta = DjangoObjectTypeOptions(cls)
|
||||||
|
|
||||||
_meta.model = model
|
_meta.model = model
|
||||||
_meta.registry = registry
|
_meta.registry = registry
|
||||||
_meta.filter_fields = filter_fields
|
_meta.filter_fields = filter_fields
|
||||||
|
|
Loading…
Reference in New Issue
Block a user