File tree 2 files changed +17
-2
lines changed
2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -409,4 +409,4 @@ class VideoBlogPage(BlogDetailPage):
409
409
),
410
410
FieldPanel ("youtube_video_id" ),
411
411
StreamFieldPanel ("content" ),
412
- ]
412
+ ]
Original file line number Diff line number Diff line change 17
17
from wagtail .core .fields import RichTextField , StreamField
18
18
from wagtail .images .edit_handlers import ImageChooserPanel
19
19
from wagtail .contrib .routable_page .models import RoutablePageMixin , route
20
+
21
+ from rest_framework .fields import Field
22
+
20
23
from streams import blocks
21
24
22
25
@@ -41,6 +44,18 @@ class HomePageCarouselImages(Orderable):
41
44
]
42
45
43
46
47
+ class BannerCTASerializer (Field ):
48
+ def to_representation (self , page ):
49
+ return {
50
+ 'id' : page .id ,
51
+ 'title' : page .title ,
52
+ 'first_published_at' : page .first_published_at ,
53
+ 'owner' : page .owner .username ,
54
+ 'slug' : page .slug ,
55
+ 'url' : page .url ,
56
+ }
57
+
58
+
44
59
class HomePage (RoutablePageMixin , Page ):
45
60
"""Home page model."""
46
61
@@ -79,7 +94,7 @@ class HomePage(RoutablePageMixin, Page):
79
94
APIField ("banner_title" ),
80
95
APIField ("banner_subtitle" ),
81
96
APIField ("banner_image" ),
82
- APIField ("banner_cta" ),
97
+ APIField ("banner_cta" , serializer = BannerCTASerializer () ),
83
98
APIField ("carousel_images" ),
84
99
APIField ("content" ),
85
100
]
You can’t perform that action at this time.
0 commit comments