use humanize to add comma to numbers

This commit is contained in:
Arvind Tiwari 2018-03-27 19:38:09 +05:30
parent 251d4928e2
commit d52c061709
8 changed files with 21 additions and 24 deletions

View file

@ -1,5 +1,5 @@
{% extends "datacenterlight/base_hosting.html" %}
{% load staticfiles bootstrap3 i18n %}
{% load staticfiles bootstrap3 i18n humanize %}
{% block css_extra %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/paymentfont/1.1.2/css/paymentfont.min.css"/>
@ -78,7 +78,7 @@
<hr>
<p>{% trans "Configuration"%} <strong class="pull-right">{{request.session.template.name}}</strong></p>
<hr>
<p class="last-p"><strong>{%trans "Total" %}</strong>&nbsp;&nbsp;<small>({%trans "including VAT" %})</small> <strong class="pull-right">{{request.session.specs.price}} CHF/{% trans "Month" %}</strong></p>
<p class="last-p"><strong>{%trans "Total" %}</strong>&nbsp;&nbsp;<small>({%trans "including VAT" %})</small> <strong class="pull-right">{{request.session.specs.price|intcomma}} CHF/{% trans "Month" %}</strong></p>
</div>
</div>
</div>

View file

@ -1,5 +1,5 @@
{% extends "datacenterlight/base_hosting.html" %}
{% load staticfiles bootstrap3 i18n custom_tags %}
{% load staticfiles bootstrap3 i18n custom_tags humanize %}
{% block content %}
<div id="order-detail{{order.pk}}" class="order-detail-container">
@ -59,15 +59,15 @@
</p>
<p>
<span>{% trans "Memory" %}: </span>
<span class="pull-right">{{vm.memory}} GB</span>
<span class="pull-right">{{vm.memory|intcomma}} GB</span>
</p>
<p>
<span>{% trans "Disk space" %}: </span>
<span class="pull-right">{{vm.disk_size}} GB</span>
<span class="pull-right">{{vm.disk_size|intcomma}} GB</span>
</p>
<p>
<span>{% trans "Total" %}</span>
<span class="pull-right">{{vm.price}} CHF</span>
<span class="pull-right">{{vm.price|intcomma}} CHF</span>
</p>
</div>
</div>

View file

@ -82,6 +82,7 @@ INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.humanize',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
@ -255,8 +256,6 @@ USE_L10N = True
USE_TZ = True
USE_THOUSAND_SEPARATOR = True
FORMAT_MODULE_PATH = [
'dynamicweb.formats'
]

View file

@ -1,7 +1,6 @@
{% extends "hosting/base_short.html" %}
{% load staticfiles bootstrap3 %}
{% load i18n %}
{% load custom_tags %}
{% load staticfiles bootstrap3 humanize i18n custom_tags %}
{% block content %}
<div id="order-detail{{order.pk}}" class="order-detail-container">
@ -130,7 +129,7 @@
</p>
<p>
<span>{% trans "Total" %}</span>
<span class="pull-right">{{vm.price}} CHF</span>
<span class="pull-right">{{vm.price|intcomma}} CHF</span>
</p>
</div>
</div>
@ -143,7 +142,7 @@
{% csrf_token %}
<div class="row">
<div class="col-sm-8">
<div class="dcl-place-order-text">{% blocktrans with vm_price=request.session.specs.price %}By clicking "Place order" this plan will charge your credit card account with the fee of {{ vm_price }}CHF/month{% endblocktrans %}.</div>
<div class="dcl-place-order-text">{% blocktrans with vm_price=request.session.specs.price %}By clicking "Place order" this plan will charge your credit card account with the fee of {{ vm_price|intcomma }}CHF/month{% endblocktrans %}.</div>
</div>
<div class="col-sm-4 order-confirm-btn text-right">
<button class="btn choice-btn" id="btn-create-vm" data-href="{% url 'hosting:order-confirmation' %}" data-toggle="modal" data-target="#createvm-modal">

View file

@ -1,6 +1,5 @@
{% extends "hosting/base_short.html" %}
{% load staticfiles bootstrap3 %}
{% load i18n l10n %}
{% load staticfiles bootstrap3 humanize i18n %}
{% block content %}
<div class="dashboard-container">
@ -30,7 +29,7 @@
<tr>
<td class="xs-td-inline" data-header="{% trans 'Order Nr.' %}">{{ order.id }}</td>
<td class="xs-td-bighalf" data-header="{% trans 'Date' %}">{{ order.created_at | date:"M d, Y H:i" }}</td>
<td class="xs-td-smallhalf" data-header="{% trans 'Amount' %}">{{ order.price }}</td>
<td class="xs-td-smallhalf" data-header="{% trans 'Amount' %}">{{ order.price|intcomma }}</td>
<td class="text-right last-td">
<a class="btn btn-order-detail" href="{% url 'hosting:orders' order.pk %}">{% trans 'See Invoice' %}</a>
</td>

View file

@ -1,5 +1,5 @@
{% extends "hosting/base_short.html" %}
{% load staticfiles bootstrap3 i18n %}
{% load staticfiles bootstrap3 i18n humanize %}
{% block css_extra %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/paymentfont/1.1.2/css/paymentfont.min.css"/>
@ -34,7 +34,7 @@
{{request.session.specs.memory|floatformat}} GB
</div>
<div class="col-xs-12 col-sm-3 col-md-3 col-lg-3 tbl-content">
{{request.session.specs.disk_size|floatformat}} GB
{{request.session.specs.disk_size|floatformat|intcomma}} GB
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4 tbl-content">
{{request.session.template.name}}
@ -46,7 +46,7 @@
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 tbl-no-padding">
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4"></div>
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 tbl-total">{{request.session.specs.price}}
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 tbl-total">{{request.session.specs.price|intcomma}}
CHF<span class="dcl-price-month">/{% trans "Month" %}</span>
</div>
</div>

View file

@ -1,5 +1,5 @@
{% extends "hosting/base_short.html" %}
{% load staticfiles bootstrap3 %}
{% load staticfiles bootstrap3 humanize %}
{% load i18n %}
{% block content %}
@ -37,7 +37,7 @@
<div class="vm-detail-config">
<p><span>{% trans "Cores" %}:</span><span class="value">{{virtual_machine.cores}}</span></p>
<p><span>{% trans "Memory" %}:</span><span class="value">{{virtual_machine.memory}} GB</span></p>
<p><span>{% trans "Disk" %}:</span><span class="value">{{virtual_machine.disk_size|floatformat:2}} GB</span></p>
<p><span>{% trans "Disk" %}:</span><span class="value">{{virtual_machine.disk_size|floatformat:2|intcomma}} GB</span></p>
<p><span>{% trans "Configuration" %}:</span><span class="value">{{virtual_machine.configuration}}</span></p>
</div>
</div>
@ -45,7 +45,7 @@
<h2 class="vm-detail-title">{% trans "Billing" %} <img src="{% static 'hosting/img/billing.svg' %}" class="un-icon"></h2>
<div class="vm-vmid">
<div class="vm-item-subtitle">{% trans "Current Pricing" %}</div>
<div class="vm-item-lg">{{virtual_machine.price|floatformat}} CHF/{% trans "Month" %}</div>
<div class="vm-item-lg">{{virtual_machine.price|floatformat|intcomma}} CHF/{% trans "Month" %}</div>
<a class="btn btn-vm-invoice" href="{% url 'hosting:orders' order.pk %}">{% trans "See Invoice" %}</a>
</div>
</div>

View file

@ -1,5 +1,5 @@
{% extends "hosting/base_short.html" %}
{% load staticfiles bootstrap3 i18n l10n %}
{% load staticfiles bootstrap3 i18n %}
{% block content %}
<div class="dashboard-container">
<div class="dashboard-container-head">
@ -40,7 +40,7 @@
<tbody>
{% for vm in vms %}
<tr>
<td data-header="ID">{{vm.vm_id|unlocalize}}</td>
<td data-header="ID">{{vm.vm_id}}</td>
<td data-header="IPv4">{% if vm.ipv4 %}{{vm.ipv4}}{% endif %}</td>
<td data-header="IPv6">{% if vm.ipv6 %}{{vm.ipv6}}{% endif %}</td>
<td data-header="{% trans 'Status' %}">