mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-11 12:16:58 +03:00
Improved documentation
This commit is contained in:
parent
ad607eb122
commit
19dff03784
|
@ -26,8 +26,8 @@ class NodeMeta(InterfaceTypeMeta):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def Field(cls):
|
def Field(cls):
|
||||||
# We put as a property for reset the field counter each time is setted up, so
|
# We put as a property for reset the field counter each time is called
|
||||||
# it will be order correctly wherever is mounted
|
# so it will be order correctly wherever is mounted
|
||||||
field = copy.copy(cls._Field)
|
field = copy.copy(cls._Field)
|
||||||
field.reset_counter()
|
field.reset_counter()
|
||||||
return field
|
return field
|
||||||
|
|
|
@ -4,10 +4,25 @@ from ..utils.orderedtype import OrderedType
|
||||||
|
|
||||||
|
|
||||||
class TypeProxy(OrderedType):
|
class TypeProxy(OrderedType):
|
||||||
|
'''
|
||||||
|
This class acts a proxy for a Graphene Type, so it can be mounted
|
||||||
|
as Field, InputField or Argument.
|
||||||
|
|
||||||
|
Instead of doing
|
||||||
|
>>> class MyObjectType(ObjectType):
|
||||||
|
>>> my_field = Field(String(), description='Description here')
|
||||||
|
|
||||||
|
You can actually do
|
||||||
|
>>> class MyObjectType(ObjectType):
|
||||||
|
>>> my_field = String(description='Description here')
|
||||||
|
|
||||||
|
So is simpler to use.
|
||||||
|
'''
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.args = args
|
self.args = args
|
||||||
self.kwargs = kwargs
|
self.kwargs = kwargs
|
||||||
OrderedType.__init__(self)
|
super(TypeProxy, self).__init__()
|
||||||
|
|
||||||
def get_type(self):
|
def get_type(self):
|
||||||
return self._meta.graphql_type
|
return self._meta.graphql_type
|
||||||
|
|
Loading…
Reference in New Issue
Block a user