fix: Handle missing locations

This commit is contained in:
moanos [he/him] 2024-09-27 19:48:05 +02:00
parent a1edb48ff5
commit 803a6ff000
2 changed files with 6 additions and 1 deletions

View File

@ -19,6 +19,7 @@
}).addControl(new maplibregl.NavigationControl());
{% for adoption_notice in adoption_notices %}
{% 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" %}`);
@ -33,5 +34,6 @@
.setLngLat(location_popup_{{ forloop.counter }})
.setPopup(popup_{{ forloop.counter }}) // sets a popup on this marker
.addTo(map);
{% endif %}
{% endfor %}
</script>

View File

@ -51,4 +51,7 @@ def get_oxitraffic_script_if_enabled():
@register.filter
@stringfilter
def pointdecimal(value):
return f"{float(value):.9f}"
try:
return f"{float(value):.9f}"
except ValueError:
return value