racourcir les libelles des actions

This commit is contained in:
2022-03-06 16:21:07 +01:00
parent 0125b73ab6
commit f97e03204f
3 changed files with 24 additions and 23 deletions

View File

@@ -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 {