mirror of
				https://github.com/graphql-python/graphene.git
				synced 2025-11-04 09:57:41 +03:00 
			
		
		
		
	Added class arguments example for Python 3
This commit is contained in:
		
							parent
							
								
									9ce1288e12
								
							
						
					
					
						commit
						e86f73d30c
					
				| 
						 | 
					@ -16,6 +16,7 @@
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  With 2.0:
 | 
					  With 2.0:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ```python
 | 
					  ```python
 | 
				
			||||||
  class CommonFields(object):
 | 
					  class CommonFields(object):
 | 
				
			||||||
      name = String()
 | 
					      name = String()
 | 
				
			||||||
| 
						 | 
					@ -23,3 +24,21 @@
 | 
				
			||||||
  class Pet(CommonFields, Interface):
 | 
					  class Pet(CommonFields, Interface):
 | 
				
			||||||
      pass
 | 
					      pass
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Meta options as class arguments (**ONLY PYTHON 3**).
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  Before:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ```python
 | 
				
			||||||
 | 
					  class Dog(ObjectType):
 | 
				
			||||||
 | 
					      class Meta:
 | 
				
			||||||
 | 
					          interfaces = [Pet]
 | 
				
			||||||
 | 
					      name = String()
 | 
				
			||||||
 | 
					  ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  With 2.0:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ```python
 | 
				
			||||||
 | 
					  class Dog(ObjectType, interfaces=[Pet]):
 | 
				
			||||||
 | 
					      name = String()
 | 
				
			||||||
 | 
					  ```
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user