don't show current item in context, link to all

This commit is contained in:
j 2017-12-23 00:06:44 +01:00
parent f7a5cdf532
commit 068d9f4201
8 changed files with 59 additions and 8 deletions

View File

@ -46,6 +46,7 @@
{% endfor %} {% endfor %}
<a href="{% url 'events_list' %}">more</a>
</div> </div>
</div> </div>

View File

@ -18,4 +18,4 @@
<p> {{ content.formatted_teaser }} </p> <p> {{ content.formatted_teaser }} </p>
</div> </div>
</div> </div>
</div> </div>

View File

@ -40,6 +40,7 @@
{% else %} {% else %}
<p>No projects.</p> <p>No projects.</p>
{% endif %} {% endif %}
<a href="{% url 'projects_list' %}">more</a>
</div> </div>
</div> </div>

View File

@ -25,7 +25,9 @@
{% elif row.type.name == 'events' %} {% elif row.type.name == 'events' %}
<div class="row results"> <div class="row results">
<div class="small-4 small-offset-2 columns"> <div class="small-4 small-offset-2 columns">
<img src="{{ row.image_url }}"> {% if row.image_url %}
<a href="{{ row.get_absolute_url }}"> <img src="{{ row.image_url }}"> </a>
{% endif %}
</div> </div>
<div class="small-4 end columns"> <div class="small-4 end columns">
<a href="{{ row.get_absolute_url }}" class="sidebar-title">{{ row.title }}</a> <a href="{{ row.get_absolute_url }}" class="sidebar-title">{{ row.title }}</a>
@ -38,7 +40,35 @@
{% elif row.type.name == 'projects' %} {% elif row.type.name == 'projects' %}
<div class="row results"> <div class="row results">
<div class="small-4 small-offset-2 columns"> <div class="small-4 small-offset-2 columns">
<img src="{{ row.image_url }}"> {% if row.image_url %}
<a href="{{ row.get_absolute_url }}"> <img src="{{ row.image_url }}"> </a>
{% endif %}
</div>
<div class="small-4 end columns">
<a href="{{ row.get_absolute_url }}" class="sidebar-title">{{ row.title }}</a>
<p> {{row.formatted_teaser}} </p>
<a href="{{ row.get_absolute_url }}">read more</a> </p>
</div>
</div>
{% elif row.type.name == 'works' %}
<div class="row results">
<div class="small-4 small-offset-2 columns">
{% if row.image_url %}
<a href="{{ row.get_absolute_url }}"> <img src="{{ row.image_url }}"> </a>
{% endif %}
</div>
<div class="small-4 end columns">
<a href="{{ row.get_absolute_url }}" class="sidebar-title">{{ row.title }}</a>
<p> {{row.formatted_teaser}} </p>
<a href="{{ row.get_absolute_url }}">read more</a> </p>
</div>
</div>
{% elif row.type.name == 'texts' %}
<div class="row results">
<div class="small-4 small-offset-2 columns">
{% if row.image_url %}
<a href="{{ row.get_absolute_url }}"> <img src="{{ row.image_url }}"> </a>
{% endif %}
</div> </div>
<div class="small-4 end columns"> <div class="small-4 end columns">
<a href="{{ row.get_absolute_url }}" class="sidebar-title">{{ row.title }}</a> <a href="{{ row.get_absolute_url }}" class="sidebar-title">{{ row.title }}</a>

View File

@ -19,6 +19,7 @@
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
<a href="index/">more</a>
</div> </div>
</div> </div>

View File

@ -45,13 +45,14 @@
{% endif %} {% endif %}
<div class="small-6 columns"> <div class="small-6 columns">
<a href="{{ texts.get_absolute_url }}" class="sidebar-title">{{ texts.title }}</a> <a href="{{ texts.get_absolute_url }}" class="sidebar-title">{{ texts.title }}</a>
<p> {{texts.header|striptags|truncatechars:100}} </p> <p> {{ texts.formatted_teaser }} </p>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
{% else %} {% else %}
<p>No texts.</p> <p>No texts.</p>
{% endif %} {% endif %}
<a href="{% url 'texts_list' %}">more</a>
</div> </div>
</div> </div>

View File

@ -39,13 +39,14 @@
</div> </div>
<div class="small-6 columns"> <div class="small-6 columns">
<a href="{{ works.get_absolute_url }}" class="sidebar-title">{{ works.title }}</a> <a href="{{ works.get_absolute_url }}" class="sidebar-title">{{ works.title }}</a>
<p> {{works.header|striptags|truncatechars:100}} </p> <p> {{ works.formatted_teaser }} </p>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
{% else %} {% else %}
<p>No works.</p> <p>No works.</p>
{% endif %} {% endif %}
<a href="{% url 'works_list' %}">more</a>
</div> </div>
</div> </div>

View File

@ -118,8 +118,14 @@ def events(request, shortname=None):
if not events.published and not request.user.is_staff: if not events.published and not request.user.is_staff:
raise Http404 raise Http404
gallery = get_or_none(Gallery, slug=shortname) gallery = get_or_none(Gallery, slug=shortname)
latest_content_list = Content.objects.filter(type__name='events').order_by('-datestart')[:10] latest_content_list = Content.objects.filter(type__name__in=['events', 'news']).order_by('-datestart')
return render(request, 'events.html', {'events': events, 'latest_content_list': latest_content_list, 'gallery': gallery}) latest_content_list = latest_content_list.exclude(pk=events.pk)
latest_content_list = latest_content_list[:10]
return render(request, 'events.html', {
'events': events,
'latest_content_list': latest_content_list,
'gallery': gallery
})
def projects(request, shortname=None): def projects(request, shortname=None):
if not shortname: if not shortname:
@ -129,6 +135,8 @@ def projects(request, shortname=None):
raise Http404 raise Http404
gallery = get_or_none(Gallery, slug=shortname) gallery = get_or_none(Gallery, slug=shortname)
latest_content_list = Content.objects.filter(type__name='projects').order_by('-datestart') latest_content_list = Content.objects.filter(type__name='projects').order_by('-datestart')
latest_content_list = latest_content_list.exclude(pk=projects.pk)
latest_content_list = latest_content_list[:10]
return render(request, 'projects.html', { return render(request, 'projects.html', {
'projects': projects, 'projects': projects,
'latest_content_list': latest_content_list, 'latest_content_list': latest_content_list,
@ -143,7 +151,13 @@ def works(request, shortname=None):
raise Http404 raise Http404
gallery = get_or_none(Gallery, slug=shortname) gallery = get_or_none(Gallery, slug=shortname)
latest_content_list = Content.objects.filter(type__name='works') latest_content_list = Content.objects.filter(type__name='works')
return render(request, 'works.html', {'works': works, 'latest_content_list': latest_content_list, 'gallery':gallery}) latest_content_list = latest_content_list.exclude(pk=works.pk)
latest_content_list = latest_content_list[:10]
return render(request, 'works.html', {
'works': works,
'latest_content_list': latest_content_list,
'gallery': gallery
})
def texts(request, shortname=None): def texts(request, shortname=None):
if not shortname: if not shortname:
@ -151,6 +165,8 @@ def texts(request, shortname=None):
texts = get_object_or_404(Content, shortname=shortname, type__name='texts') texts = get_object_or_404(Content, shortname=shortname, type__name='texts')
gallery = get_or_none(Gallery, slug=shortname) gallery = get_or_none(Gallery, slug=shortname)
latest_content_list = Content.objects.filter(type__name='texts') latest_content_list = Content.objects.filter(type__name='texts')
latest_content_list = latest_content_list.exclude(pk=texts.pk)
latest_content_list = latest_content_list[:10]
return render(request, 'texts.html', { return render(request, 'texts.html', {
'texts': texts, 'texts': texts,
'latest_content_list': latest_content_list, 'latest_content_list': latest_content_list,