Skip to content

Commit 72fdc61

Browse files
committed
Serializing Custom Page Properties
1 parent 3465f28 commit 72fdc61

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

home/models.py

+7
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,15 @@ class HomePage(RoutablePageMixin, Page):
9797
APIField("banner_cta", serializer=BannerCTASerializer()),
9898
APIField("carousel_images"),
9999
APIField("content"),
100+
APIField("a_custom_api_response"),
100101
]
101102

103+
@property
104+
def a_custom_api_response(self):
105+
# return ["SOMETHING CUSTOM", 3.14, [1, 2, 3, 'a', 'b', 'c']]
106+
# logic goes in here
107+
return f"Banner Title Is: {self.banner_title}"
108+
102109
content_panels = Page.content_panels + [
103110
MultiFieldPanel(
104111
[InlinePanel("carousel_images", max_num=5, min_num=1, label="Image")],

0 commit comments

Comments
 (0)