List subcategories on index page
This commit is contained in:
parent
8a3cef9484
commit
11128a10a9
3 changed files with 34 additions and 17 deletions
|
@ -41,9 +41,15 @@ class ArticleIndexPage(Page):
|
|||
context = super(ArticleIndexPage, self).get_context(request)
|
||||
articles = ArticlePage.objects.child_of(self).live()
|
||||
context['articles'] = articles
|
||||
subcategories = ArticleIndexPage.objects.child_of(self).live()
|
||||
context['subcategories'] = subcategories
|
||||
return context
|
||||
|
||||
subpage_types = ['home.ArticlePage', 'home.ArticleIndexPage', 'home.ContactForm']
|
||||
subpage_types = [
|
||||
'home.ArticlePage',
|
||||
'home.ArticleIndexPage',
|
||||
'home.ContactForm'
|
||||
]
|
||||
class Meta:
|
||||
verbose_name = "Rubrik"
|
||||
|
||||
|
|
|
@ -6,24 +6,35 @@
|
|||
{% block content %}
|
||||
<section id="article-index">
|
||||
<div class="container">
|
||||
|
||||
<h2>{{ page.trans_title }}</h2>
|
||||
|
||||
<p class="lead">{{ page.trans_intro|richtext }}</p>
|
||||
|
||||
<div class="article-body" role="main">
|
||||
{% for entry in articles %}
|
||||
<div class="item">
|
||||
<div class="article-caption">
|
||||
<h3><a href="{% pageurl entry %}">{{ entry.trans_title }}</a></h3>
|
||||
<p>{{ entry.trans_intro|richtext }}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% empty %}
|
||||
___
|
||||
{% endfor %}
|
||||
|
||||
<div class="article-body" role="main">
|
||||
{% for entry in articles %}
|
||||
<div class="item">
|
||||
<div class="article-caption">
|
||||
<h3><a href="{% pageurl entry %}">{{ entry.trans_title }}</a></h3>
|
||||
<p>{{ entry.trans_intro|richtext }}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div><!-- /container -->
|
||||
</section>
|
||||
|
||||
{% if subcategories %}
|
||||
<section id="three" class="article-subcategories" class="wrapper align-center">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
{% for block in subcategories %}
|
||||
<article class="col-md-4">
|
||||
<header><a href="{% pageurl block %}">
|
||||
<h3>{{ block.trans_title }}</h3>
|
||||
</a></header>
|
||||
{{ block.trans_intro|richtext }}
|
||||
</article>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div><!-- /container -->
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Core
|
||||
wagtail==1.9
|
||||
Django==1.11
|
||||
Django==1.10.7
|
||||
|
||||
# Database
|
||||
psycopg2==2.7.1
|
||||
|
|
Loading…
Add table
Reference in a new issue