diff --git a/caotek_mesavoirs/layout.py b/caotek_mesavoirs/layout.py index 69aa715..262dd5d 100644 --- a/caotek_mesavoirs/layout.py +++ b/caotek_mesavoirs/layout.py @@ -24,7 +24,16 @@ class GlobalLayout(object): return to_decimal(x) def to_euro(self, x): - return to_euro(x) + if x == 0: + return '' + else: + return to_euro(x) + + def zero2space(self, x): + if x == 0: + return '' + else: + return x def to_usd(self, x): return to_usd(x) diff --git a/caotek_mesavoirs/templates/portfolio/portfolio.pt b/caotek_mesavoirs/templates/portfolio/portfolio.pt index 7c0e19c..ac3f95b 100644 --- a/caotek_mesavoirs/templates/portfolio/portfolio.pt +++ b/caotek_mesavoirs/templates/portfolio/portfolio.pt @@ -108,7 +108,7 @@ +/- Valeur % de +/- Rdt brut - TER + % TER % PF @@ -123,11 +123,11 @@ ${layout.to_euro(ligne.valeur)} ${layout.to_euro(ligne.plus_value)} ${layout.to_euro(ligne.plus_value)} - ${layout.to_percent(ligne.pc_plusvalue,1)} - ${layout.to_percent(ligne.pc_plusvalue,1)} + ${ligne.pc_plusvalue} + ${ligne.pc_plusvalue} ${layout.to_euro(ligne.rendement)} - ${layout.to_percent(ligne.ter,2)} - ${ligne.pc_allocation} % + ${layout.zero2space(ligne.ter)} + ${ligne.pc_allocation} Total @@ -138,7 +138,7 @@ ${layout.to_percent(total_pc_value, 1)} ${layout.to_euro(total_rdt)} - 100.0 % + 100.0 diff --git a/caotek_mesavoirs/views/portfolio.py b/caotek_mesavoirs/views/portfolio.py index 6ff3e11..b3ca9cf 100644 --- a/caotek_mesavoirs/views/portfolio.py +++ b/caotek_mesavoirs/views/portfolio.py @@ -1,22 +1,10 @@ # -*- coding: utf8 -*- -from pyramid.response import Response -from pyramid.renderers import render, get_renderer from pyramid.view import ( view_config, - forbidden_view_config, -) + ) from pyramid.httpexceptions import ( HTTPFound, - HTTPNotFound, - HTTPForbidden, -) -from pyramid_mailer import get_mailer -from pyramid_mailer.message import Message, Attachment -from datetime import * -import hashlib - -from sqlalchemy.exc import DBAPIError -from ..security import groupfinder + ) from ..models.default import * from ..models.portfolio import * @@ -172,14 +160,18 @@ def actif_edit(request): ticker = yf.Ticker(symbole) new_values['cours'] = ticker.info.get('regularMarketPrice') new_values['devise'] = ticker.info.get('currency') - new_values['libelle'] = html.unescape(ticker.info.get('shortName')) + libelle = html.unescape(ticker.info.get('shortName')) + # raccourcir le libelle + libelle = libelle.replace('UCITS ','') + libelle = libelle.replace('World U','World') + new_values['libelle'] = libelle update_actif(request, no_id, new_values) request.session.flash(u"La fiche a été mise à jour avec succès.", 'success') return HTTPFound(location=request.route_url('portfolio')) if 'form.deleted' in request.params: delete_actif(request, no_id) - request.session.flash(u"La fiche a été supprimée avec succès.", 'success') + request.session.flash(u"La fiche as été supprimée avec succès.", 'success') return HTTPFound(location=request.route_url('portfolio')) return {