File tree 1 file changed +11
-0
lines changed
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 19
19
from wagtail .core .fields import StreamField
20
20
from wagtail .core .models import Page , Orderable
21
21
from wagtail .images .edit_handlers import ImageChooserPanel
22
+ from wagtail .images .api .fields import ImageRenditionField
22
23
from wagtail .contrib .routable_page .models import RoutablePageMixin , route
23
24
from wagtail .snippets .models import register_snippet
24
25
@@ -66,7 +67,17 @@ def author_image(self):
66
67
api_fields = [
67
68
APIField ("author_name" ),
68
69
APIField ("author_website" ),
70
+ # This is using a custom django rest framework serializer
69
71
APIField ("author_image" , serializer = ImageSerializedField ()),
72
+ # The below APIField is using a Wagtail-built DRF Serializer that supports
73
+ # custom image rendition sizes
74
+ APIField (
75
+ "image" ,
76
+ serializer = ImageRenditionField (
77
+ 'fill-200x250' ,
78
+ source = "author_image"
79
+ )
80
+ ),
70
81
]
71
82
72
83
You can’t perform that action at this time.
0 commit comments