Banner filter homepage
This commit is contained in:
parent
4ebe3ec4d2
commit
e1a13e354b
2 changed files with 2 additions and 3 deletions
|
@ -271,8 +271,9 @@ class HomePage(Page):
|
||||||
@property
|
@property
|
||||||
def featured(self):
|
def featured(self):
|
||||||
# Get list of live pages that are descendants of this page
|
# 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(on_homepage=True)
|
||||||
|
articles = articles.filter(feed_image__isnull=False)
|
||||||
# Order by most recent date first
|
# Order by most recent date first
|
||||||
#articles = articles.order_by('-date')
|
#articles = articles.order_by('-date')
|
||||||
return articles[:4]
|
return articles[:4]
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
<div id="carousel-banner" class="slide">
|
<div id="carousel-banner" class="slide">
|
||||||
<div class="carousel-inner slick" role="listbox">
|
<div class="carousel-inner slick" role="listbox">
|
||||||
{% for entry in featured %}
|
{% for entry in featured %}
|
||||||
{% if entry.feed_image %}
|
|
||||||
<div class="item">
|
<div class="item">
|
||||||
{% image entry.feed_image original as entry_photo %}
|
{% image entry.feed_image original as entry_photo %}
|
||||||
<image style="background-image:url({{ entry_photo.url }})">
|
<image style="background-image:url({{ entry_photo.url }})">
|
||||||
|
@ -14,7 +13,6 @@
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
{% empty %}
|
{% empty %}
|
||||||
<i style="background-color:yellow">Please add articles to the front page using the "Featured" option.</i>
|
<i style="background-color:yellow">Please add articles to the front page using the "Featured" option.</i>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Add table
Reference in a new issue