From 068d9f4201a0f4b901757be2521be41d79416c7c Mon Sep 17 00:00:00 2001 From: j Date: Sat, 23 Dec 2017 00:06:44 +0100 Subject: [PATCH] don't show current item in context, link to all --- content/templates/events.html | 1 + content/templates/preview.html | 2 +- content/templates/projects.html | 1 + content/templates/results.html | 34 ++++++++++++++++++++++++++-- content/templates/section_index.html | 1 + content/templates/texts.html | 3 ++- content/templates/works.html | 3 ++- content/views.py | 22 +++++++++++++++--- 8 files changed, 59 insertions(+), 8 deletions(-) diff --git a/content/templates/events.html b/content/templates/events.html index 47558ef..77e8d5b 100644 --- a/content/templates/events.html +++ b/content/templates/events.html @@ -46,6 +46,7 @@ {% endfor %} + more diff --git a/content/templates/preview.html b/content/templates/preview.html index 363e2a4..287410e 100644 --- a/content/templates/preview.html +++ b/content/templates/preview.html @@ -18,4 +18,4 @@

{{ content.formatted_teaser }}

- \ No newline at end of file + diff --git a/content/templates/projects.html b/content/templates/projects.html index da42b03..2be8880 100644 --- a/content/templates/projects.html +++ b/content/templates/projects.html @@ -40,6 +40,7 @@ {% else %}

No projects.

{% endif %} + more diff --git a/content/templates/results.html b/content/templates/results.html index 3fe19b2..7df050b 100644 --- a/content/templates/results.html +++ b/content/templates/results.html @@ -25,7 +25,9 @@ {% elif row.type.name == 'events' %}
- + {% if row.image_url %} + + {% endif %}
{{ row.title }} @@ -38,7 +40,35 @@ {% elif row.type.name == 'projects' %}
- + {% if row.image_url %} + + {% endif %} +
+
+ {{ row.title }} +

{{row.formatted_teaser}}

+ read more

+
+
+ {% elif row.type.name == 'works' %} +
+
+ {% if row.image_url %} + + {% endif %} +
+
+ {{ row.title }} +

{{row.formatted_teaser}}

+ read more

+
+
+ {% elif row.type.name == 'texts' %} +
+
+ {% if row.image_url %} + + {% endif %}
{{ row.title }} diff --git a/content/templates/section_index.html b/content/templates/section_index.html index a1ad1bf..ac450f6 100644 --- a/content/templates/section_index.html +++ b/content/templates/section_index.html @@ -19,6 +19,7 @@
{% endfor %} + more
diff --git a/content/templates/texts.html b/content/templates/texts.html index a76abb6..baf35c6 100644 --- a/content/templates/texts.html +++ b/content/templates/texts.html @@ -45,13 +45,14 @@ {% endif %}
{{ texts.title }} -

{{texts.header|striptags|truncatechars:100}}

+

{{ texts.formatted_teaser }}

{% endfor %} {% else %}

No texts.

{% endif %} + more diff --git a/content/templates/works.html b/content/templates/works.html index a8bbd69..3848b4f 100644 --- a/content/templates/works.html +++ b/content/templates/works.html @@ -39,13 +39,14 @@
{{ works.title }} -

{{works.header|striptags|truncatechars:100}}

+

{{ works.formatted_teaser }}

{% endfor %} {% else %}

No works.

{% endif %} + more diff --git a/content/views.py b/content/views.py index 6f4d8f5..489fc18 100644 --- a/content/views.py +++ b/content/views.py @@ -118,8 +118,14 @@ def events(request, shortname=None): if not events.published and not request.user.is_staff: raise Http404 gallery = get_or_none(Gallery, slug=shortname) - latest_content_list = Content.objects.filter(type__name='events').order_by('-datestart')[:10] - return render(request, 'events.html', {'events': events, 'latest_content_list': latest_content_list, 'gallery': gallery}) + latest_content_list = Content.objects.filter(type__name__in=['events', 'news']).order_by('-datestart') + 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): if not shortname: @@ -129,6 +135,8 @@ def projects(request, shortname=None): raise Http404 gallery = get_or_none(Gallery, slug=shortname) 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', { 'projects': projects, 'latest_content_list': latest_content_list, @@ -143,7 +151,13 @@ def works(request, shortname=None): raise Http404 gallery = get_or_none(Gallery, slug=shortname) 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): if not shortname: @@ -151,6 +165,8 @@ def texts(request, shortname=None): texts = get_object_or_404(Content, shortname=shortname, type__name='texts') gallery = get_or_none(Gallery, slug=shortname) 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', { 'texts': texts, 'latest_content_list': latest_content_list,