[printing] Possibilité d'afficher des blacklists seule
This commit is contained in:
parent
937aefb3ec
commit
db6cf98661
5 changed files with 27 additions and 10 deletions
|
@ -43,7 +43,7 @@ def prise_etat(chbre):
|
|||
def timeformat(t, format):
|
||||
return time.strftime(format, time.localtime(t))
|
||||
|
||||
def blacklist(l):
|
||||
def blacklists(l):
|
||||
bl=[]
|
||||
for b in l:
|
||||
debut=b['debut'] if b['debut'] == '-' else time.strftime("%d/%m/%Y %H:%M", time.localtime(b['debut']))
|
||||
|
@ -103,7 +103,7 @@ def template(dialog=False):
|
|||
templateEnv = jinja2.Environment( loader=templateLoader, trim_blocks=True )
|
||||
templateEnv.add_extension('jinja2.ext.do')
|
||||
templateEnv.filters['coul'] = coul
|
||||
templateEnv.filters['blacklist'] = blacklist
|
||||
templateEnv.filters['blacklists'] = blacklists
|
||||
templateEnv.filters['prise_etat'] = prise_etat
|
||||
templateEnv.filters['timeformat'] = timeformat
|
||||
templateEnv.filters['split'] = split
|
||||
|
@ -200,9 +200,13 @@ def facture(facture, params):
|
|||
params['o']=facture
|
||||
return template().get_template("facture").render(params)
|
||||
|
||||
def sprint(object, limit=5):
|
||||
from lc_ldap import objets
|
||||
params={'limit':limit}
|
||||
def blacklist(blacklist, params):
|
||||
params['o']=blacklist
|
||||
return template().get_template("blacklist").render(params)
|
||||
|
||||
def sprint(object, limit=5, **params):
|
||||
from lc_ldap import objets, attributs
|
||||
params.update({'limit':limit})
|
||||
if isinstance(object, objets.machine):
|
||||
return machine(object, params)
|
||||
elif isinstance(object, objets.adherent):
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
{% if o.get('blacklist', []) %}
|
||||
{{"Blackliste : "|coul('gras')}}{{o.get('blacklist', [])[-limit:]|reverse|blacklist|join('\n ')}}
|
||||
{{"Blackliste : "|coul('gras')}}{{o.type|coul('rouge')}}
|
||||
{{"Commentaire : "|coul('gras')}}{{o.comm}}
|
||||
{{"Date de début : "|coul('gras')}}{{o.debut|timeformat('%d/%m/%Y %H:%M:%S')}}
|
||||
{{"Date de fin : "|coul('gras')}}{% if o.fin != '-' %}
|
||||
{{o.fin|timeformat('%d/%m/%Y %H:%M:%S')}}
|
||||
{% else %}
|
||||
{{"sans fin"|coul('rouge')}}
|
||||
{% endif %}
|
||||
{{"État : "|coul('gras')}}{% if o.actif %}
|
||||
{{"ACTIVE"|coul('rouge')}}
|
||||
{% else %}
|
||||
{{"INACTIVE"|coul('vert')}}
|
||||
{% endif %}
|
||||
{% include 'object' %}
|
||||
|
|
4
printing/templates/blacklists
Normal file
4
printing/templates/blacklists
Normal file
|
@ -0,0 +1,4 @@
|
|||
{% if o.get('blacklist', []) %}
|
||||
{{"Blackliste : "|coul('gras')}}{{o.get('blacklist', [])[-limit:]|reverse|blacklists|join('\n ')}}
|
||||
{% endif %}
|
||||
{% include 'object' %}
|
|
@ -16,4 +16,4 @@
|
|||
{% elif o.proprio().cid %}
|
||||
{{"Propriétaire : "|coul('gras')}}{{o.proprio().nom|join(', ')}} (cid={{o.proprio().cid|join(', ')}})
|
||||
{% endif %}
|
||||
{% include 'blacklist' %}
|
||||
{% include 'blacklists' %}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
{% if brassage %}
|
||||
{{"Brassage : "|coul('gras')}}{{brassage}}
|
||||
{% endif %}
|
||||
{% include 'blacklist' %}
|
||||
{% include 'blacklists' %}
|
||||
|
||||
{{machines}}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue