[list_droits] Un peu de trie et pas de liste de droits hardcodé
On affiche aussi l'année d'arrivé de l'adhérent
This commit is contained in:
parent
938dd6c210
commit
225ee9c248
1 changed files with 14 additions and 4 deletions
|
@ -9,15 +9,25 @@ from ldap_crans import crans_ldap, decode
|
||||||
db = crans_ldap()
|
db = crans_ldap()
|
||||||
txts = []
|
txts = []
|
||||||
|
|
||||||
for droit in [ u'Nounou', u'Apprenti', u'Moderateur', u'Cableur', u'Webradio' , u'Imprimeur', u'Bureau', u'Tresorier', u'Troll'] :
|
adhs=db.search('droits=*')['adherent']
|
||||||
adhs = db.search('droits=%s' % droit)['adherent']
|
droits={}
|
||||||
|
for adh in adhs:
|
||||||
|
for droit in adh.droits():
|
||||||
|
droits[droit] = droits.get(droit, []) + [adh]
|
||||||
|
|
||||||
|
d=droits.keys()
|
||||||
|
d.sort()
|
||||||
|
|
||||||
|
for droit in d:
|
||||||
|
adhs = droits[droit]
|
||||||
|
|
||||||
noms = []
|
noms = []
|
||||||
|
|
||||||
txt = '%s\n' % droit
|
txt = '%s\n' % droit
|
||||||
for adh in adhs :
|
for adh in adhs :
|
||||||
noms.append(u'%s' % adh.Nom())
|
noms.append(u'%s (%s)' % (adh.Nom(), adh.historique()[0].split(' ', 1)[0].split('/',2)[-1]))
|
||||||
|
|
||||||
|
noms.sort()
|
||||||
txt += u' %s' % '\n '.join(noms)
|
txt += u' %s' % '\n '.join(noms)
|
||||||
|
|
||||||
txts.append(txt)
|
txts.append(txt)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue