Fix code style of example in Wagtail API docs

Example code should be compliant with PEP-8.
pull/9229/head
Storm Heg 2022-09-19 09:54:32 +02:00 zatwierdzone przez LB (Ben Johnston)
rodzic 3fa153016b
commit 6a8ce3161e
3 zmienionych plików z 11 dodań i 9 usunięć

Wyświetl plik

@ -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)

Wyświetl plik

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

Wyświetl plik

@ -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)