lingo: include decimals in basket badget (if any) (#23716)
This commit is contained in:
parent
9ba3f603ed
commit
f13b4cc5ac
|
@ -36,6 +36,7 @@ from django.utils import timezone, dateparse
|
|||
from django.core.mail import EmailMultiAlternatives
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.core.exceptions import ObjectDoesNotExist, PermissionDenied
|
||||
from django.utils.formats import localize
|
||||
from django.utils.http import urlencode
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
|
@ -517,7 +518,9 @@ class LingoBasketCell(CellBase):
|
|||
if not items:
|
||||
return
|
||||
total = sum([x.amount for x in items])
|
||||
return {'badge': _(u'%d€') % total}
|
||||
if total == int(total):
|
||||
total = int(total)
|
||||
return {'badge': _(u'%s€') % localize(total)}
|
||||
|
||||
def render(self, context):
|
||||
basket_template = template.loader.get_template('lingo/combo/basket.html')
|
||||
|
|
|
@ -84,6 +84,10 @@ def test_basket_cell(regie, user):
|
|||
assert '12345' in content
|
||||
assert '667' not in content
|
||||
|
||||
item.amount = 123.45
|
||||
item.save()
|
||||
assert cell.get_badge(context) == {'badge': u'123.45€'}
|
||||
|
||||
def test_recent_transaction_cell(regie, user):
|
||||
page = Page(title='xxx', slug='test_basket_cell', template_name='standard')
|
||||
page.save()
|
||||
|
|
Loading…
Reference in New Issue