mirror of
				https://github.com/graphql-python/graphene.git
				synced 2025-10-31 07:57:26 +03:00 
			
		
		
		
	Improved documentation
This commit is contained in:
		
							parent
							
								
									ad607eb122
								
							
						
					
					
						commit
						19dff03784
					
				|  | @ -26,8 +26,8 @@ class NodeMeta(InterfaceTypeMeta): | |||
| 
 | ||||
|     @property | ||||
|     def Field(cls): | ||||
|         # We put as a property for reset the field counter each time is setted up, so | ||||
|         # it will be order correctly wherever is mounted | ||||
|         # We put as a property for reset the field counter each time is called | ||||
|         # so it will be order correctly wherever is mounted | ||||
|         field = copy.copy(cls._Field) | ||||
|         field.reset_counter() | ||||
|         return field | ||||
|  |  | |||
|  | @ -4,10 +4,25 @@ from ..utils.orderedtype import 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): | ||||
|         self.args = args | ||||
|         self.kwargs = kwargs | ||||
|         OrderedType.__init__(self) | ||||
|         super(TypeProxy, self).__init__() | ||||
| 
 | ||||
|     def get_type(self): | ||||
|         return self._meta.graphql_type | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user