forked from CGM_Public/pretix_original
* 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:
@@ -13,6 +13,7 @@ from pretix.base.forms.questions import (
|
||||
)
|
||||
from pretix.base.models import ItemVariation
|
||||
from pretix.base.models.tax import TAXED_ZERO
|
||||
from pretix.base.templatetags.money import money_filter
|
||||
from pretix.base.templatetags.rich_text import rich_text
|
||||
from pretix.base.validators import EmailBlacklistValidator
|
||||
from pretix.presale.signals import contact_form_fields
|
||||
@@ -133,17 +134,17 @@ class AddOnsForm(forms.Form):
|
||||
name=label
|
||||
)
|
||||
elif not price.rate:
|
||||
n = _('{name} (+ {currency} {price})').format(
|
||||
name=label, currency=event.currency, price=number_format(price.gross)
|
||||
n = _('{name} (+ {price})').format(
|
||||
name=label, price=money_filter(price.gross, event.currency)
|
||||
)
|
||||
elif event.settings.display_net_prices:
|
||||
n = _('{name} (+ {currency} {price} plus {taxes}% {taxname})').format(
|
||||
name=label, currency=event.currency, price=number_format(price.net),
|
||||
n = _('{name} (+ {price} plus {taxes}% {taxname})').format(
|
||||
name=label, price=money_filter(price.net, event.currency),
|
||||
taxes=number_format(price.rate), taxname=price.name
|
||||
)
|
||||
else:
|
||||
n = _('{name} (+ {currency} {price} incl. {taxes}% {taxname})').format(
|
||||
name=label, currency=event.currency, price=number_format(price.gross),
|
||||
n = _('{name} (+ {price} incl. {taxes}% {taxname})').format(
|
||||
name=label, price=money_filter(price.gross, event.currency),
|
||||
taxes=number_format(price.rate), taxname=price.name
|
||||
)
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{% extends "pretixpresale/event/checkout_base.html" %}
|
||||
{% load i18n %}
|
||||
{% load money %}
|
||||
{% load bootstrap3 %}
|
||||
{% block inner %}
|
||||
<p>{% trans "Please select how you want to pay." %}</p>
|
||||
@@ -12,7 +13,7 @@
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
{% if show_fees %}
|
||||
<strong class="pull-right">{% if p.fee < 0 %}-{% else %}+{% endif %} {{ p.fee|floatformat:2|cut:"-" }} {{ event.currency }}</strong>
|
||||
<strong class="pull-right">{% if p.fee < 0 %}-{% else %}+{% endif %} {{ p.fee|money:event.currency|cut:"-" }}</strong>
|
||||
{% endif %}
|
||||
<input type="radio" name="payment" value="{{ p.provider.identifier }}"
|
||||
data-parent="#payment_accordion"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{% load i18n %}
|
||||
{% load eventurl %}
|
||||
{% load safelink %}
|
||||
{% load money %}
|
||||
{% blocktrans asvar s_taxes %}taxes{% endblocktrans %}
|
||||
{% for line in cart.positions %}
|
||||
<div class="row cart-row {% if download and line.item.admission|default:event.settings.ticket_download_nonadm %}has-downloads{% endif %}">
|
||||
@@ -71,9 +72,9 @@
|
||||
<div class="count"> </div>
|
||||
<div class="singleprice price">
|
||||
{% if event.settings.display_net_prices %}
|
||||
{{ event.currency }} {{ line.net_price|floatformat:2 }}
|
||||
{{ line.net_price|money:event.currency }}
|
||||
{% else %}
|
||||
{{ event.currency }} {{ line.price|floatformat:2 }}
|
||||
{{ line.price|money:event.currency }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
@@ -113,15 +114,15 @@
|
||||
</div>
|
||||
<div class="singleprice price">
|
||||
{% if event.settings.display_net_prices %}
|
||||
{{ event.currency }} {{ line.net_price|floatformat:2 }}
|
||||
{{ line.net_price|money:event.currency }}
|
||||
{% else %}
|
||||
{{ event.currency }} {{ line.price|floatformat:2 }}
|
||||
{{ line.price|money:event.currency }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="totalprice price">
|
||||
{% if event.settings.display_net_prices %}
|
||||
<strong>{{ event.currency }} {{ line.net_total|floatformat:2 }}</strong>
|
||||
<strong>{{ line.net_total|money:event.currency }}</strong>
|
||||
{% if line.tax_rate and line.total %}
|
||||
<br />
|
||||
<small>
|
||||
@@ -131,7 +132,7 @@
|
||||
</small>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<strong>{{ event.currency }} {{ line.total|floatformat:2 }}</strong>
|
||||
<strong>{{ line.total|money:event.currency }}</strong>
|
||||
{% if line.tax_rate and line.total %}
|
||||
<br />
|
||||
<small>
|
||||
@@ -165,7 +166,7 @@
|
||||
</div>
|
||||
<div class="col-md-3 col-xs-6 col-md-offset-5 price">
|
||||
{% if event.settings.display_net_prices %}
|
||||
<strong>{{ event.currency }} {{ fee.net_value|floatformat:2 }}</strong>
|
||||
<strong>{{ fee.net_value|money:event.currency }}</strong>
|
||||
{% if fee.tax_rate %}
|
||||
<br />
|
||||
<small>
|
||||
@@ -175,7 +176,7 @@
|
||||
</small>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<strong>{{ event.currency }} {{ fee.value|floatformat:2 }}</strong>
|
||||
<strong>{{ fee.value|money:event.currency }}</strong>
|
||||
{% if fee.tax_rate %}
|
||||
<br />
|
||||
<small>
|
||||
@@ -195,7 +196,7 @@
|
||||
<strong>{% trans "Net total" %}</strong>
|
||||
</div>
|
||||
<div class="col-md-3 col-xs-6 col-md-offset-5 price">
|
||||
{{ event.currency }} {{ cart.net_total|floatformat:2 }}
|
||||
{{ cart.net_total|money:event.currency }}
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
@@ -204,7 +205,7 @@
|
||||
<strong>{% trans "Taxes" %}</strong>
|
||||
</div>
|
||||
<div class="col-md-3 col-xs-6 col-md-offset-5 price">
|
||||
{{ event.currency }} {{ cart.tax_total|floatformat:2 }}
|
||||
{{ cart.tax_total|money:event.currency }}
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
@@ -214,7 +215,7 @@
|
||||
<strong>{% trans "Total" %}</strong>
|
||||
</div>
|
||||
<div class="col-md-3 col-xs-6 col-md-offset-5 price">
|
||||
<strong>{{ event.currency }} {{ cart.total|floatformat:2 }}</strong>
|
||||
<strong>{{ cart.total|money:event.currency }}</strong>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
{% load i18n %}
|
||||
{% load l10n %}
|
||||
{% load eventurl %}
|
||||
{% load money %}
|
||||
{% load thumbnail %}
|
||||
{% load eventsignal %}
|
||||
{% load rich_text %}
|
||||
@@ -250,13 +251,13 @@
|
||||
</div>
|
||||
<div class="col-md-2 col-xs-6 price">
|
||||
{% if item.min_price != item.max_price or item.free_price %}
|
||||
{% blocktrans trimmed with minprice=item.min_price|floatformat:2 currency=event.currency %}
|
||||
from {{ currency }} {{ minprice }}
|
||||
{% blocktrans trimmed with minprice=item.min_price|money:event.currency %}
|
||||
from {{ minprice }}
|
||||
{% endblocktrans %}
|
||||
{% elif not item.min_price and not item.max_price %}
|
||||
{% trans "FREE" context "price" %}
|
||||
{% else %}
|
||||
{{ event.currency }} {{ item.min_price|floatformat:2 }}
|
||||
{{ item.min_price|money:event.currency }}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-md-2 col-xs-6 availability-box">
|
||||
@@ -288,18 +289,18 @@
|
||||
<span class="input-group-addon">{{ event.currency }}</span>
|
||||
<input type="number" class="form-control input-item-price"
|
||||
placeholder="0"
|
||||
min="{% if event.settings.display_net_prices %}{{ var.display_price.net|stringformat:"0.2f" }}{% else %}{{ var.display_price.gross|stringformat:"0.2f" }}{% endif %}"
|
||||
min="{% if event.settings.display_net_prices %}{{ var.display_price.net|money_numberfield:event.currency }}{% else %}{{ var.display_price.gross|money_numberfield:event.currency }}{% endif %}"
|
||||
name="price_{{ item.id }}_{{ var.id }}"
|
||||
step="any"
|
||||
value="{% if event.settings.display_net_prices %}{{var.display_price.net|stringformat:"0.2f" }}{% else %}{{ var.display_price.gross|stringformat:"0.2f" }}{% endif %}"
|
||||
value="{% if event.settings.display_net_prices %}{{var.display_price.net|money_numberfield:event.currency }}{% else %}{{ var.display_price.gross|money_numberfield:event.currency }}{% endif %}"
|
||||
>
|
||||
</div>
|
||||
{% elif not var.display_price.gross %}
|
||||
{% trans "FREE" context "price" %}
|
||||
{% elif event.settings.display_net_prices %}
|
||||
{{ event.currency }} {{ var.display_price.net|floatformat:2 }}
|
||||
{{ var.display_price.net|money:event.currency }}
|
||||
{% else %}
|
||||
{{ event.currency }} {{ var.display_price.gross|floatformat:2 }}
|
||||
{{ var.display_price.gross|money:event.currency }}
|
||||
{% endif %}
|
||||
{% if var.display_price.rate and var.display_price.gross and event.settings.display_net_prices %}
|
||||
<small>{% blocktrans trimmed with rate=var.display_price.rate name=var.display_price.name %}
|
||||
@@ -377,17 +378,17 @@
|
||||
<div class="input-group input-group-price">
|
||||
<span class="input-group-addon">{{ event.currency }}</span>
|
||||
<input type="number" class="form-control input-item-price" placeholder="0"
|
||||
min="{% if event.settings.display_net_prices %}{{ item.display_price.net|stringformat:"0.2f" }}{% else %}{{ item.display_price.gross|stringformat:"0.2f" }}{% endif %}"
|
||||
min="{% if event.settings.display_net_prices %}{{ item.display_price.net|money_numberfield:event.currency }}{% else %}{{ item.display_price.gross|money_numberfield:event.currency }}{% endif %}"
|
||||
name="price_{{ item.id }}"
|
||||
value="{% if event.settings.display_net_prices %}{{item.display_price.net|stringformat:"0.2f" }}{% else %}{{ item.display_price.gross|stringformat:"0.2f" }}{% endif %}"
|
||||
value="{% if event.settings.display_net_prices %}{{item.display_price.net|money_numberfield:event.currency }}{% else %}{{ item.display_price.gross|money_numberfield:event.currency }}{% endif %}"
|
||||
step="any">
|
||||
</div>
|
||||
{% elif not item.display_price.gross %}
|
||||
{% trans "FREE" context "price" %}
|
||||
{% elif event.settings.display_net_prices %}
|
||||
{{ event.currency }} {{ item.display_price.net|floatformat:2 }}
|
||||
{{ item.display_price.net|money:event.currency }}
|
||||
{% else %}
|
||||
{{ event.currency }} {{ item.display_price.gross|floatformat:2 }}
|
||||
{{ item.display_price.gross|money:event.currency }}
|
||||
{% endif %}
|
||||
{% if item.display_price.rate and item.display_price.gross and event.settings.display_net_prices %}
|
||||
<small>{% blocktrans trimmed with rate=item.display_price.rate name=item.display_price.name %}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{% extends "pretixpresale/event/base.html" %}
|
||||
{% load i18n %}
|
||||
{% load eventurl %}
|
||||
{% load money %}
|
||||
{% block title %}{% trans "Change payment method" %}{% endblock %}
|
||||
{% block content %}
|
||||
<h2>
|
||||
@@ -22,7 +23,7 @@
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<label class="radio">
|
||||
<strong class="pull-right">{% if p.fee_diff >= 0 %}+{% else %}-{% endif %} {{ p.fee_diff_abs|floatformat:2 }} {{ event.currency }}</strong>
|
||||
<strong class="pull-right">{% if p.fee_diff >= 0 %}+{% else %}-{% endif %} {{ p.fee_diff_abs|money:event.currency }}</strong>
|
||||
<input type="radio" name="payment" value="{{ p.provider.identifier }}"
|
||||
data-parent="#payment_accordion"
|
||||
{% if selected == p.provider.identifier %}checked="checked"{% endif %}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{% extends "pretixpresale/event/base.html" %}
|
||||
{% load i18n %}
|
||||
{% load eventurl %}
|
||||
{% load money %}
|
||||
{% block title %}{% trans "Pay order" %}{% endblock %}
|
||||
{% block content %}
|
||||
<h2>
|
||||
@@ -18,8 +19,8 @@
|
||||
<div class="panel-heading">
|
||||
<div class="pull-right">
|
||||
<strong>
|
||||
{% blocktrans trimmed with total=order.total|floatformat:2 currency=request.event.currency %}
|
||||
Total: {{ total }} {{ currency }}
|
||||
{% blocktrans trimmed with total=order.total|money:request.event.currency %}
|
||||
Total: {{ total }}
|
||||
{% endblocktrans %}
|
||||
</strong>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{% extends "pretixpresale/event/base.html" %}
|
||||
{% load i18n %}
|
||||
{% load l10n %}
|
||||
{% load money %}
|
||||
{% load eventurl %}
|
||||
{% load eventsignal %}
|
||||
{% load thumbnail %}
|
||||
@@ -56,13 +57,13 @@
|
||||
</div>
|
||||
<div class="col-md-2 col-xs-6 price">
|
||||
{% if item.min_price != item.max_price or item.free_price %}
|
||||
{% blocktrans trimmed with minprice=item.min_price|floatformat:2 currency=event.currency %}
|
||||
from {{ currency }} {{ minprice }}
|
||||
{% blocktrans trimmed with minprice=item.min_price|money:event.currency %}
|
||||
from {{ minprice }}
|
||||
{% endblocktrans %}
|
||||
{% elif not item.min_price and not item.max_price %}
|
||||
{% trans "FREE" context "price" %}
|
||||
{% else %}
|
||||
{{ event.currency }} {{ item.min_price|floatformat:2 }}
|
||||
{{ item.min_price|money:event.currency }}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-md-2 col-xs-6 availability-box">
|
||||
@@ -94,9 +95,9 @@
|
||||
{% elif not var.display_price.gross %}
|
||||
{% trans "FREE" context "price" %}
|
||||
{% elif event.settings.display_net_prices %}
|
||||
{{ event.currency }} {{ var.display_price.net|floatformat:2 }}
|
||||
{{ var.display_price.net|money:event.currency }}
|
||||
{% else %}
|
||||
{{ event.currency }} {{ var.display_price.gross|floatformat:2 }}
|
||||
{{ var.display_price.gross|money:event.currency }}
|
||||
{% endif %}
|
||||
{% if var.display_price.rate and var.display_price.gross and event.settings.display_net_prices %}
|
||||
<small>{% blocktrans trimmed with rate=var.display_price.rate name=var.display_price.name %}
|
||||
@@ -164,9 +165,9 @@
|
||||
{% elif not item.display_price.gross %}
|
||||
{% trans "FREE" context "price" %}
|
||||
{% elif event.settings.display_net_prices %}
|
||||
{{ event.currency }} {{ item.display_price.net|floatformat:2 }}
|
||||
{{ item.display_price.net|money:event.currency }}
|
||||
{% else %}
|
||||
{{ event.currency }} {{ item.display_price.gross|floatformat:2 }}
|
||||
{{ item.display_price.gross|money:event.currency }}
|
||||
{% endif %}
|
||||
{% if item.display_price.rate and item.display_price.gross and event.settings.display_net_prices %}
|
||||
<small>{% blocktrans trimmed with rate=item.display_price.rate name=item.display_price.name %}
|
||||
|
||||
Reference in New Issue
Block a user