diff --git a/project/home/models.py b/project/home/models.py index b4ad419..709ea4d 100755 --- a/project/home/models.py +++ b/project/home/models.py @@ -1,7 +1,7 @@ from wagtail.wagtailcore.models import Page from wagtail.wagtailcore.fields import RichTextField from wagtail.wagtailadmin.edit_handlers import FieldPanel - +from project.blog.models import BlogPage from project.common.models import Entity @@ -13,3 +13,8 @@ class HomePage(Entity): content_panels = Page.content_panels + [ FieldPanel('body', classname="full") ] + + def get_context(self, *args, **kwargs): + context = super().get_context(*args, **kwargs) + context['blog_posts'] = BlogPage.objects.live().order_by('-post_date')[:4] + return context diff --git a/templates/home/home_page.html b/templates/home/home_page.html index bbabc57..3bf7122 100755 --- a/templates/home/home_page.html +++ b/templates/home/home_page.html @@ -96,6 +96,15 @@
{{ post.get_meta_description }}
+