@@ -8,10 +8,12 @@ This way, we make the library smart enough to convert automatically the
8
8
relations between models to Graphene fields automatically (when possible).
9
9
10
10
11
- get_global_registry
12
- -------------------
11
+ Global registry
12
+ ---------------
13
13
14
14
By default, all model/objecttype relations will live in the global registry.
15
+ You retrieve using the function ``get_global_registry `` in
16
+ ``graphene_django.registry ``.
15
17
16
18
.. code :: python
17
19
@@ -26,12 +28,16 @@ By default, all model/objecttype relations will live in the global registry.
26
28
global_registry.get_type_for_model(ReporterModel) # == Reporter
27
29
28
30
29
- One Model, multiple types
30
- -------------------------
31
+ Multiple types for one model
32
+ ----------------------------
31
33
32
34
There will be some cases where we need one Django Model to
33
35
have multiple graphene ``ObjectType``s associated to it.
34
36
37
+ In this case, we can either use ``skip_global_registry `` to create
38
+ a new isolated registry for that type (so it doesn't interfere with
39
+ the global registry), or we can create a custom registry for it.
40
+
35
41
.. code :: python
36
42
37
43
from graphene_django.registry import Registry
@@ -49,5 +55,6 @@ have multiple graphene ``ObjectType``s associated to it.
49
55
# We can also specify a custom registry with
50
56
# registry = Registry()
51
57
58
+
52
59
This way, the ``ReporterModel `` could have two different types living in the same
53
60
schema.
0 commit comments