mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-22 05:49:59 +03:00
Tweak enum examples
This commit is contained in:
parent
3327ca47c2
commit
0dca8ef1c8
|
@ -61,7 +61,8 @@ you can add description etc. to your enum without changing the original:
|
|||
|
||||
graphene.Enum.from_enum(
|
||||
AlreadyExistingPyEnum,
|
||||
description=lambda v: return 'foo' if v == AlreadyExistingPyEnum.Foo else 'bar')
|
||||
description=lambda v: return 'foo' if v == AlreadyExistingPyEnum.Foo else 'bar'
|
||||
)
|
||||
|
||||
|
||||
Notes
|
||||
|
@ -76,6 +77,7 @@ In the Python ``Enum`` implementation you can access a member by initing the Enu
|
|||
.. code:: python
|
||||
|
||||
from enum import Enum
|
||||
|
||||
class Color(Enum):
|
||||
RED = 1
|
||||
GREEN = 2
|
||||
|
@ -89,6 +91,7 @@ However, in Graphene ``Enum`` you need to call get to have the same effect:
|
|||
.. code:: python
|
||||
|
||||
from graphene import Enum
|
||||
|
||||
class Color(Enum):
|
||||
RED = 1
|
||||
GREEN = 2
|
||||
|
|
Loading…
Reference in New Issue
Block a user