Skip to content

Commit

Permalink
feat(models): why export date?
Browse files Browse the repository at this point in the history
  • Loading branch information
hUwUtao committed Jun 5, 2024
1 parent 411aba9 commit 70aec30
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions blog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ class BlogPage(Page, TFRenditionGroup):
FieldPanel('body'),
]

@property
def blog_date(self):
return self.first_published_at

@property
def thumbnail_set(self):
return self.rendition_set(
Expand All @@ -49,6 +53,7 @@ def thumbnail_set(self):
api_fields = [
APIField('body'),
APIField('intro'),
APIField('blog_date'),
APIField('thumbnail_set'),
# APIField(
# 'authors'
Expand Down
5 changes: 5 additions & 0 deletions gallery/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ class Picture(Page, TFRenditionGroup):
FieldPanel('image'),
]

@property
def image_date(self):
return self.image.created_at

@property
def image_set(self):
return self.rendition_set(
Expand All @@ -49,6 +53,7 @@ def image_set(self):
api_fields = [
APIField('cap'),
APIField('image'),
APIField('image_date'),
APIField('image_set'),
# APIField(
# 'authors'
Expand Down

0 comments on commit 70aec30

Please sign in to comment.