mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-22 17:46:57 +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:
|
||||
|
||||
```python
|
||||
class CommonFields(object):
|
||||
name = String()
|
||||
|
@ -23,3 +24,21 @@
|
|||
class Pet(CommonFields, Interface):
|
||||
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