From 4e4f1202391eb6fdcf1d48a55bf21e9783cc4cee Mon Sep 17 00:00:00 2001 From: moanos Date: Sat, 28 Sep 2024 13:56:10 +0200 Subject: [PATCH] fix: Use dedicated context variable for map to not interfer withother displays --- .../templates/fellchensammlung/partials/partial-map.html | 2 +- src/fellchensammlung/views.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fellchensammlung/templates/fellchensammlung/partials/partial-map.html b/src/fellchensammlung/templates/fellchensammlung/partials/partial-map.html index 2e73ef3..a8ab722 100644 --- a/src/fellchensammlung/templates/fellchensammlung/partials/partial-map.html +++ b/src/fellchensammlung/templates/fellchensammlung/partials/partial-map.html @@ -19,7 +19,7 @@ zoom: 5 }).addControl(new maplibregl.NavigationControl()); - {% for adoption_notice in adoption_notices %} + {% for adoption_notice in adoption_notices_map %} {% if adoption_notice.location %} // create the popup const popup_{{ forloop.counter }} = new maplibregl.Popup({offset: 25}).setHTML(`{% include "fellchensammlung/partials/partial-adoption-notice-minimal.html" %}`); diff --git a/src/fellchensammlung/views.py b/src/fellchensammlung/views.py index 687130c..6e9aa83 100644 --- a/src/fellchensammlung/views.py +++ b/src/fellchensammlung/views.py @@ -39,13 +39,13 @@ def fail_if_user_not_owner_or_trust_level(user, django_object, trust_level=User. def index(request): """View function for home page of site.""" latest_adoption_list = AdoptionNotice.objects.filter( - adoptionnoticestatus__major_status=AdoptionNoticeStatus.ACTIVE).order_by("-created_at")[:5] + adoptionnoticestatus__major_status=AdoptionNoticeStatus.ACTIVE).order_by("-created_at") active_adoptions = [adoption for adoption in latest_adoption_list if adoption.is_active] language_code = translation.get_language() lang = Language.objects.get(languagecode=language_code) active_announcements = Announcement.get_active_announcements(lang) - context = {"adoption_notices": active_adoptions, "announcements": active_announcements} + context = {"adoption_notices": active_adoptions[:5], "adoption_notices_map": active_adoptions, "announcements": active_announcements} for text_code in ["how_to", "introduction"]: try: context[text_code] = Text.objects.get(text_code=text_code, language=lang, ) @@ -398,7 +398,7 @@ def modqueue(request): def map(request): adoption_notices = AdoptionNotice.objects.all() #TODO: Filter to active - context = {"adoption_notices": adoption_notices} + context = {"adoption_notices_map": adoption_notices} return render(request, 'fellchensammlung/map.html', context=context)