Browse Source

docs: APIField naming (#9173)

Christophe Bastin 2 years ago
parent
commit
5dad39fb57
2 changed files with 7 additions and 6 deletions
  1. 1 0
      CONTRIBUTORS.rst
  2. 6 6
      docs/advanced_topics/api/v2/configuration.md

+ 1 - 0
CONTRIBUTORS.rst

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

+ 6 - 6
docs/advanced_topics/api/v2/configuration.md

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