kopia lustrzana https://github.com/wagtail/wagtail
docs: APIField naming (#9173)
rodzic
2804ebfec2
commit
5dad39fb57
|
@ -623,6 +623,7 @@ Contributors
|
|||
* Kurt Wall
|
||||
* Adam Johnson
|
||||
* Josh Thomas
|
||||
* Christophe Bastin
|
||||
|
||||
|
||||
Translators
|
||||
|
|
|
@ -106,14 +106,14 @@ For example:
|
|||
```python
|
||||
# blog/models.py
|
||||
|
||||
from wagtail.api import apifield
|
||||
from wagtail.api import APIField
|
||||
|
||||
class blogpageauthor(orderable):
|
||||
page = models.foreignkey('blog.blogpage', on_delete=models.cascade, related_name='authors')
|
||||
name = models.charfield(max_length=255)
|
||||
|
||||
api_fields = [
|
||||
apifield('name'),
|
||||
APIField('name'),
|
||||
]
|
||||
|
||||
|
||||
|
@ -125,10 +125,10 @@ class blogpage(page):
|
|||
|
||||
# export fields over the api
|
||||
api_fields = [
|
||||
apifield('published_date'),
|
||||
apifield('body'),
|
||||
apifield('feed_image'),
|
||||
apifield('authors'), # this will nest the relevant blogpageauthor objects in the api response
|
||||
APIField('published_date'),
|
||||
APIField('body'),
|
||||
APIField('feed_image'),
|
||||
APIField('authors'), # this will nest the relevant blogpageauthor objects in the api response
|
||||
]
|
||||
```
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue