Refs #99 -- Improve support for currencies with less than 2 decimal places (#783)

* Refs #99 -- Fix stripe support for zero-decimal currencies

* Add new money formatting method

* Force decimal places in many places

* Locale-aware currency rendering

* Fix currencies in more places

* More currency fixes
This commit is contained in:
Raphael Michel
2018-02-26 10:46:07 +01:00
committed by GitHub
parent 29e22a0c6c
commit 3c3e59e932
49 changed files with 467 additions and 211 deletions

View File

@@ -1,7 +1,7 @@
{% load i18n %}{% load l10n %}{% blocktrans with bank=details|safe code=order.full_code total=order.total|localize currency=event.currency %}
{% load i18n %}{% load l10n %}{% load money %}{% blocktrans with bank=details|safe code=order.full_code total=order.total|money:event.currency %}
Please transfer the full amount to the following bank account.
Reference: {{ code }}
Amount: {{ total }} {{ currency }}
Amount: {{ total }}
{{ bank }}
{% endblocktrans %}

View File

@@ -1,5 +1,6 @@
{% load i18n %}
{% load l10n %}
{% load money %}
<p>{% blocktrans trimmed %}
Please transfer the full amount to the following bank account:
@@ -7,6 +8,6 @@
<address>
{{ details|linebreaksbr }}<br />
{% trans "Amount:" %} {{ order.total|localize }} {{ event.currency }}<br />
{% trans "Amount:" %} {{ order.total|money:event.currency }}<br />
<strong>{% trans "Reference code (important):" %} {{ order.full_code }}</strong>
</address>

View File

@@ -1,5 +1,6 @@
{% load i18n %}
{% load rich_text %}
{% load money %}
{% load staticfiles %}
<div class="table-responsive">
{% csrf_token %}
@@ -85,7 +86,7 @@
<td>
{% if trans.order %}
<a href="{% url "control:event.order" event=trans.order.event.slug organizer=request.organizer.slug code=trans.order.code %}"
data-toggle="tooltip" title="{{ trans.order.total|floatformat:2 }} {{ trans.order.event.currency }}">
data-toggle="tooltip" title="{{ trans.order.total|money:trans.order.event.currency }}">
{% if not request.event %}
{{ trans.order.event.slug|upper }}-{{ trans.order.code }}
{% else %}

View File

@@ -18,6 +18,7 @@ from pretix.base.models import Order, Quota
from pretix.base.services.mail import SendMailException
from pretix.base.services.orders import mark_order_paid
from pretix.base.settings import SettingsSandbox
from pretix.base.templatetags.money import money_filter
from pretix.control.permissions import (
EventPermissionRequiredMixin, OrganizerPermissionRequiredMixin,
)
@@ -147,8 +148,6 @@ class ActionView(View):
})
def get(self, request, *args, **kwargs):
from django.utils.formats import localize
u = request.GET.get('query', '')
if len(u) < 2:
return JsonResponse({'results': []})
@@ -178,7 +177,7 @@ class ActionView(View):
{
'code': o.event.slug.upper() + '-' + o.code,
'status': o.get_status_display(),
'total': localize(o.total) + ' ' + o.event.currency
'total': money_filter(o.total, o.event.currency)
} for o in qs
]
})