Allow nodes to skip the registry

This commit is contained in:
Matthías Páll Gissurarson 2017-02-02 20:12:51 +01:00
parent 5d6c7f2dc3
commit aed7229bae
2 changed files with 3 additions and 1 deletions

View File

@ -13,7 +13,8 @@ class Registry(object):
# assert self.get_type_for_model(cls._meta.model) == cls, (
# 'Multiple DjangoObjectTypes registered for "{}"'.format(cls._meta.model)
# )
self._registry[cls._meta.model] = cls
if not getattr(cls._meta, 'skip_registry', False):
self._registry[cls._meta.model] = cls
def get_type_for_model(self, model):
return self._registry.get(model)

View File

@ -58,6 +58,7 @@ class DjangoObjectTypeMeta(ObjectTypeMeta):
only_fields=(),
exclude_fields=(),
interfaces=(),
skip_registry=False,
registry=None
)
if DJANGO_FILTER_INSTALLED: