Browse Source

Fix code style of example in Wagtail API docs

Example code should be compliant with PEP-8.
Storm Heg 2 years ago
parent
commit
6a8ce3161e
3 changed files with 11 additions and 9 deletions
  1. 1 0
      CHANGELOG.txt
  2. 9 9
      docs/advanced_topics/api/v2/configuration.md
  3. 1 0
      docs/releases/4.0.2.md

+ 1 - 0
CHANGELOG.txt

@@ -48,6 +48,7 @@ Changelog
  * Fix: Add missing vertical space between header and content in embed chooser modal (LB (Ben) Johnston)
  * Fix: Use the correct type scale for heading levels in rich text (Steven Steinwand)
  * Fix: Update alignment and reveal logic of fields’ comment buttons (Steven Steinwand)
+ * Fix: Regression from Markdown conversion in documentation for API configuration - update to correctly use PEP-8 for example code (Storm Heg)
 
 
 4.0.1 (05.09.2022)

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

@@ -108,27 +108,27 @@ For example:
 
 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)
+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'),
     ]
 
 
-class blogpage(page):
-    published_date = models.datetimefield()
-    body = richtextfield()
-    feed_image = models.foreignkey('wagtailimages.image', on_delete=models.set_null, null=true, ...)
-    private_field = models.charfield(max_length=255)
+class BlogPage(page):
+    published_date = models.DateTimeField()
+    body = RichTextField()
+    feed_image = models.ForeignKey('wagtailimages.Image', on_delete=models.SET_NULL, null=true, ...)
+    private_field = models.CharField(max_length=255)
 
     # 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('authors'),  # this will nest the relevant BlogPageAuthor objects in the api response
     ]
 ```
 

+ 1 - 0
docs/releases/4.0.2.md

@@ -26,3 +26,4 @@ depth: 1
  * Add missing vertical space between header and content in embed chooser modal (LB (Ben) Johnston)
  * Use the correct type scale for heading levels in rich text (Steven Steinwand)
  * Update alignment and reveal logic of fields’ comment buttons (Steven Steinwand)
+ * Regression from Markdown conversion in documentation for API configuration - update to correctly use PEP-8 for example code (Storm Heg)