mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-09 00:58:16 -06:00
16202 fix mapit button for internationalized decimal seperator
This commit is contained in:
parent
6c51b89502
commit
9fe3c9fc8b
@ -63,7 +63,7 @@
|
||||
{% if object.latitude and object.longitude %}
|
||||
{% if config.MAPS_URL %}
|
||||
<div class="position-absolute top-50 end-0 translate-middle-y d-print-none">
|
||||
<a href="{{ config.MAPS_URL }}{{ object.latitude }},{{ object.longitude }}" target="_blank" class="btn btn-primary">
|
||||
<a href="{{ config.MAPS_URL }}{{ object.latitude|untranslate_decimal_separator }},{{ object.longitude|untranslate_decimal_separator }}" target="_blank" class="btn btn-primary">
|
||||
<i class="mdi mdi-map-marker"></i> {% trans "Map It" %}
|
||||
</a>
|
||||
</div>
|
||||
|
@ -95,7 +95,7 @@
|
||||
{% if object.latitude and object.longitude %}
|
||||
{% if config.MAPS_URL %}
|
||||
<div class="position-absolute top-50 end-0 translate-middle-y d-print-none">
|
||||
<a href="{{ config.MAPS_URL }}{{ object.latitude }},{{ object.longitude }}" target="_blank" class="btn btn-primary">
|
||||
<a href="{{ config.MAPS_URL }}{{ object.latitude|untranslate_decimal_separator }},{{ object.longitude|untranslate_decimal_separator }}" target="_blank" class="btn btn-primary">
|
||||
<i class="mdi mdi-map-marker"></i> {% trans "Map It" %}
|
||||
</a>
|
||||
</div>
|
||||
|
@ -8,7 +8,9 @@ from django.conf import settings
|
||||
from django.template.defaultfilters import date
|
||||
from django.urls import NoReverseMatch, reverse
|
||||
from django.utils import timezone
|
||||
from django.utils.formats import get_format
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import get_language
|
||||
|
||||
from core.models import ObjectType
|
||||
from utilities.forms import get_selected_values, TableConfigForm
|
||||
@ -30,6 +32,7 @@ __all__ = (
|
||||
'startswith',
|
||||
'status_from_tag',
|
||||
'table_config_form',
|
||||
'untranslate_decimal_separator',
|
||||
'utilization_graph',
|
||||
'validated_viewname',
|
||||
'viewname',
|
||||
@ -301,3 +304,9 @@ def applied_filters(context, model, form, query_params):
|
||||
'applied_filters': applied_filters,
|
||||
'save_link': save_link,
|
||||
}
|
||||
|
||||
|
||||
@register.filter()
|
||||
def untranslate_decimal_separator(number: str):
|
||||
decimal_seperator = get_format('DECIMAL_SEPARATOR', get_language())
|
||||
return str(number).replace(decimal_seperator, ".")
|
||||
|
Loading…
Reference in New Issue
Block a user