fix: don't use search when checking specialized rescue orgs

This commit is contained in:
2025-08-12 06:16:27 +02:00
parent 5d333b28ab
commit a372be4af2
2 changed files with 28 additions and 20 deletions

View File

@@ -17,22 +17,24 @@
{% block content %} {% block content %}
<div class="columns block"> <div class="columns block">
<div class=" column is-two-thirds"> <div class=" column {% if show_search %}is-two-thirds {% endif %}">
<div style="height: 70vh"> <div style="height: 70vh">
{% include "fellchensammlung/partials/partial-map.html" %} {% include "fellchensammlung/partials/partial-map.html" %}
</div> </div>
</div> </div>
<div class="column is-one-third"> {% if show_search %}
<form method="GET" autocomplete="off"> <div class="column is-one-third">
<input type="hidden" name="longitude" maxlength="200" id="longitude"> <form method="GET" autocomplete="off">
<input type="hidden" name="latitude" maxlength="200" id="latitude"> <input type="hidden" name="longitude" maxlength="200" id="longitude">
<!--- https://docs.djangoproject.com/en/5.2/topics/forms/#reusable-form-templates --> <input type="hidden" name="latitude" maxlength="200" id="latitude">
{{ search_form }} <!--- https://docs.djangoproject.com/en/5.2/topics/forms/#reusable-form-templates -->
<button class="button is-primary is-fullwidth" type="submit" value="search" name="action"> {{ search_form }}
<i class="fas fa-search fa-fw"></i> {% trans 'Suchen' %} <button class="button is-primary is-fullwidth" type="submit" value="search" name="action">
</button> <i class="fas fa-search fa-fw"></i> {% trans 'Suchen' %}
</form> </button>
</div> </form>
</div>
{% endif %}
</div> </div>
<div class="block"> <div class="block">

View File

@@ -754,6 +754,7 @@ def list_rescue_organizations(request, species=None, template='fellchensammlung/
org_search = RescueOrgSearch(request) org_search = RescueOrgSearch(request)
rescue_organizations = org_search.get_rescue_orgs() rescue_organizations = org_search.get_rescue_orgs()
else: else:
org_search = None
rescue_organizations = RescueOrganization.objects.filter(specializations=species) rescue_organizations = RescueOrganization.objects.filter(specializations=species)
paginator = Paginator(rescue_organizations, 10) paginator = Paginator(rescue_organizations, 10)
@@ -771,15 +772,20 @@ def list_rescue_organizations(request, species=None, template='fellchensammlung/
context = {"rescue_organizations_to_list": rescue_organizations_to_list, context = {"rescue_organizations_to_list": rescue_organizations_to_list,
"show_rescue_orgs": True, "show_rescue_orgs": True,
"elided_page_range": paginator.get_elided_page_range(page_number, on_each_side=2, on_ends=1), "elided_page_range": paginator.get_elided_page_range(page_number, on_each_side=2, on_ends=1),
"search_form": org_search.search_form,
"place_not_found": org_search.place_not_found,
"map_center": org_search.position,
"search_center": org_search.position,
"map_pins": [org_search],
"location": org_search.location,
"search_radius": org_search.max_distance,
"zoom_level": zoom_level_for_radius(org_search.max_distance),
} }
if org_search:
additional_context = {
"show_search": True,
"search_form": org_search.search_form,
"place_not_found": org_search.place_not_found,
"map_center": org_search.position,
"search_center": org_search.position,
"map_pins": [org_search],
"location": org_search.location,
"search_radius": org_search.max_distance,
"zoom_level": zoom_level_for_radius(org_search.max_distance),
}
context.update(additional_context)
return render(request, template, context=context) return render(request, template, context=context)