docs: APIField naming (#9173)

pull/9172/head
Christophe Bastin 2022-09-09 12:15:10 +02:00 zatwierdzone przez Matt Westcott
rodzic 2804ebfec2
commit 5dad39fb57
2 zmienionych plików z 7 dodań i 6 usunięć

Wyświetl plik

@ -623,6 +623,7 @@ Contributors
* Kurt Wall
* Adam Johnson
* Josh Thomas
* Christophe Bastin
Translators

Wyświetl plik

@ -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
]
```