File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,13 @@ the ``Enum.from_enum`` function.
54
54
55
55
graphene.Enum.from_enum(AlreadyExistingPyEnum)
56
56
57
+ ``Enum.from_enum `` supports a ``description `` and ``deprecation_reason `` lambdas as input so
58
+ you can add description etc. to your enum without changing the original:
59
+
60
+ .. code :: python
61
+
62
+ graphene.Enum.from_enum(AlreadyExistingPyEnum, description = lambda value : return ' foo' if value == AlreadyExistingPyEnum.Foo else ' bar' )
63
+
57
64
58
65
Notes
59
66
-----
@@ -65,7 +72,7 @@ member getters.
65
72
In the Python ``Enum `` implementation you can access a member by initing the Enum.
66
73
67
74
.. code :: python
68
-
75
+
69
76
from enum import Enum
70
77
class Color (Enum ):
71
78
RED = 1
@@ -78,7 +85,7 @@ In the Python ``Enum`` implementation you can access a member by initing the Enu
78
85
However, in Graphene ``Enum `` you need to call get to have the same effect:
79
86
80
87
.. code :: python
81
-
88
+
82
89
from graphene import Enum
83
90
class Color (Enum ):
84
91
RED = 1
You can’t perform that action at this time.
0 commit comments