diff --git a/static/src/scss/_listing.scss b/static/src/scss/_listing.scss index 1859806..7a10ac8 100644 --- a/static/src/scss/_listing.scss +++ b/static/src/scss/_listing.scss @@ -6,6 +6,10 @@ align-items: center; } + p.image { + width: 100%; + } + .media img { object-fit: cover; width: 100%; diff --git a/website/common/models.py b/website/common/models.py index 09bbb24..a38615e 100644 --- a/website/common/models.py +++ b/website/common/models.py @@ -1,6 +1,7 @@ from typing import Any from django.db import models +from django.http.request import HttpRequest from django.utils.functional import classproperty from wagtail.admin.panels import FieldPanel from wagtail.images import get_image_model_string @@ -42,3 +43,10 @@ class ContentPage(BasePage, BaseContentMixin): # type: ignore[misc] class ListingPage(BasePage, BaseContentMixin): # type: ignore[misc] content_panels = BasePage.content_panels + BaseContentMixin.content_panels + + def get_context(self, request: HttpRequest) -> dict: + context = super().get_context(request) + context["child_pages"] = ( + self.get_children().live().specific().select_related("hero_image") + ) + return context diff --git a/website/common/templates/common/listing-item.html b/website/common/templates/common/listing-item.html index b16d960..bf0cc2b 100644 --- a/website/common/templates/common/listing-item.html +++ b/website/common/templates/common/listing-item.html @@ -1,13 +1,15 @@ +{% load wagtailcore_tags wagtailimages_tags %} +

- +

-

Title

+

{{ page.title }}

2022-04-15 4 minutes #programming #security #website

{% lorem 1 p %}
diff --git a/website/common/templates/common/listing_page.html b/website/common/templates/common/listing_page.html index 4b7d7ca..8a009f3 100644 --- a/website/common/templates/common/listing_page.html +++ b/website/common/templates/common/listing_page.html @@ -7,7 +7,7 @@ {% include "common/hero.html" %}
- {% for i in 9|range %} + {% for page in child_pages %} {% include "common/listing-item.html" %} {% endfor %}