Banner filter homepage

This commit is contained in:
Oleg Lavrovsky 2018-05-25 16:38:06 +02:00
parent 4ebe3ec4d2
commit e1a13e354b
2 changed files with 2 additions and 3 deletions

View file

@ -271,8 +271,9 @@ class HomePage(Page):
@property
def featured(self):
# Get list of live pages that are descendants of this page
articles = ArticlePage.objects.live() #.descendant_of(self)
articles = ArticlePage.objects.live().descendant_of(self)
articles = articles.filter(on_homepage=True)
articles = articles.filter(feed_image__isnull=False)
# Order by most recent date first
#articles = articles.order_by('-date')
return articles[:4]

View file

@ -3,7 +3,6 @@
<div id="carousel-banner" class="slide">
<div class="carousel-inner slick" role="listbox">
{% for entry in featured %}
{% if entry.feed_image %}
<div class="item">
{% image entry.feed_image original as entry_photo %}
<image style="background-image:url({{ entry_photo.url }})">
@ -14,7 +13,6 @@
</div>
</a>
</div>
{% endif %}
{% empty %}
<i style="background-color:yellow">Please add articles to the front page using the "Featured" option.</i>
{% endfor %}