more content
This commit is contained in:
parent
f25482a3e1
commit
daf305d123
|
@ -1,18 +1,18 @@
|
||||||
{% if latest_content_list %}
|
<div class="large-4 medium-4 columns">
|
||||||
<div class="large-4 medium-4 columns">
|
{% include "related.html" with related=content.children.all %}
|
||||||
{% include "related.html" with related=content.children.all %}
|
{% if latest_content_list %}
|
||||||
<h4 class="sidebar-h4">{{section}}</h4>
|
<h4 class="sidebar-h4">{{section}}</h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% for content in latest_content_list %}
|
{% for content in latest_content_list %}
|
||||||
{% include "preview.html" with content=content %}
|
{% include "preview.html" with content=content %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% with section|lower|add:'_list' as section_list %}
|
{% with section|lower|add:'_list' as section_list %}
|
||||||
{% if has_more_content %}
|
{% if has_more_content %}
|
||||||
<a href="{% url section_list %}">more</a>
|
<a href="{% url section_list %}">more</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>No content.</p>
|
{% if 0 %}<p>No content.</p>{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
|
@ -1,4 +1,14 @@
|
||||||
<div class="row right-items">
|
<div class="row right-items">
|
||||||
|
{% if content.type.name == 'news' %}
|
||||||
|
<div class= "small-12 columns">
|
||||||
|
<h6 class="sidebar-date">
|
||||||
|
<font color="#ef4e5c"> <b> {{content.datestart}} </b>
|
||||||
|
{{ content.title }} <br />
|
||||||
|
{{ content.formatted_header }}
|
||||||
|
</font>
|
||||||
|
</h6>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
<div class="small-6 columns">
|
<div class="small-6 columns">
|
||||||
{% if content.image_url %}
|
{% if content.image_url %}
|
||||||
<a href="{{ content.get_absolute_url }}"><img src="{{ content.image_url }}"></a>
|
<a href="{{ content.get_absolute_url }}"><img src="{{ content.image_url }}"></a>
|
||||||
|
@ -15,5 +25,6 @@
|
||||||
</h6>
|
</h6>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p> {{ content.formatted_teaser }} </p>
|
<p> {{ content.formatted_teaser }} </p>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
{% include "featured.html" %}
|
{% include "featured.html" %}
|
||||||
|
|
||||||
<div class="large-4 medium-4 columns">
|
<div class="large-4 medium-4 columns">
|
||||||
|
{% if content %}
|
||||||
<h4 class="sidebar-h4"> {{ section }} </h4>
|
<h4 class="sidebar-h4"> {{ section }} </h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% for content in content %}
|
{% for content in content %}
|
||||||
|
@ -19,8 +20,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% if more_content %}
|
||||||
<a href="index/">more</a>
|
<a href="index/">more</a>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -50,16 +50,19 @@ def section_content(section):
|
||||||
return content
|
return content
|
||||||
|
|
||||||
|
|
||||||
def section_index(request, section):
|
def section_index(request, section, max_length=10):
|
||||||
types = SECTION_TYPE.get(section, [section.lower()])
|
types = SECTION_TYPE.get(section, [section.lower()])
|
||||||
featured = Content.objects.filter(type__name__in=types, featured=True).order_by('-datestart')[:1]
|
featured = Content.objects.filter(type__name__in=types, featured=True).order_by('-datestart')[:1]
|
||||||
content = section_content(section)
|
content = section_content(section)
|
||||||
if featured:
|
if featured:
|
||||||
content = content.exclude(pk=featured[0].pk)
|
content = content.exclude(pk=featured[0].pk)
|
||||||
|
more_content = content.count() > max_length
|
||||||
|
content = content[:max_length]
|
||||||
return render(request, 'section_index.html', {
|
return render(request, 'section_index.html', {
|
||||||
'section': section,
|
'section': section,
|
||||||
'featured': featured,
|
'featured': featured,
|
||||||
'content': content
|
'content': content,
|
||||||
|
'more_content': more_content,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,7 +120,7 @@ def get_related_content(types, current=None, max_length=10):
|
||||||
if current:
|
if current:
|
||||||
latest_content_list = latest_content_list.exclude(pk=current.pk)
|
latest_content_list = latest_content_list.exclude(pk=current.pk)
|
||||||
latest_content_list = latest_content_list.filter(published=True)
|
latest_content_list = latest_content_list.filter(published=True)
|
||||||
more = latest_content_list.count > max_length
|
more = latest_content_list.count() > max_length
|
||||||
latest_content_list = latest_content_list[:max_length]
|
latest_content_list = latest_content_list[:max_length]
|
||||||
return latest_content_list, more
|
return latest_content_list, more
|
||||||
|
|
||||||
|
@ -153,7 +156,7 @@ def works(request, shortname=None):
|
||||||
|
|
||||||
|
|
||||||
def texts(request, shortname=None):
|
def texts(request, shortname=None):
|
||||||
return render_content(requests, shortname, 'Texts', 'content.html', ['texts'])
|
return render_content(request, shortname, 'Texts', 'content.html', ['texts'])
|
||||||
|
|
||||||
|
|
||||||
def page(request, shortname):
|
def page(request, shortname):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user