Skip to content

Commit 3d629ab

Browse files
committed
fix: convert comma to dot; fix bug on chrome for german localization
1 parent 5d7e48f commit 3d629ab

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

myapp/templates/edit-item.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% extends "base.html" %}
22
{% load i18n %}
33
{% load static %}
4-
4+
{% load extras %}
55
{% block content %}
66

77
<div class="pagetitle">
@@ -108,7 +108,7 @@ <h5 class="card-title">{% trans "Item Details" %}</h5>
108108
<label for="value" class="col-sm-2 col-form-label">{% trans "Value" %}</label>
109109
<div class="col-sm-10">
110110
<div class="input-group">
111-
<input placeholder="{% trans 'The value of the item' %}" type="number" class="form-control" id="value" name="value" step="0.01" min="0.00" value="{{ item.value }}" required>
111+
<input placeholder="{% trans 'The value of the item' %}" type="number" class="form-control" id="value" name="value" step="0.01" min="0.00" value="{{ item.value|comma_to_dot }}" required>
112112
<button class="btn btn-outline-secondary d-none" type="button" id="toggle-value-type">
113113
<span id="value-type-icon" class="bi bi-cash-coin"></span>
114114
</button>

myapp/templatetags/extras.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@
77
@register.filter
88
def env(key):
99
if key == "OIDC_ENABLED":
10-
return settings.OIDC_ENABLED
10+
return settings.OIDC_ENABLED
11+
12+
@register.filter()
13+
def comma_to_dot(value):
14+
return str(value).replace(',', '.')

0 commit comments

Comments
 (0)