no debug toolbar
[auf_rh_dae.git] / project / dae / templatetags / dae.py
CommitLineData
5579d48d 1from django import template
286d0aa9 2from project.dae.workflow import ETATS_EDITABLE
d8cfc3d5 3from project.dae.workflow import grp_correspondants_rh, grp_administrateurs, grp_drh
5579d48d
OL
4
5register = template.Library()
6
7@register.filter
8def peut_ajouter(user):
9 for g in user.groups.all():
d8cfc3d5 10 if g in (grp_administrateurs, grp_correspondants_rh, grp_drh):
5579d48d
OL
11 return True
12 return False
13
286d0aa9 14@register.filter
e7ee680f
OL
15def est_editable(obj, user):
16 klass = obj.__class__
17 groupes_users = user.groups.all()
18 if (obj.etat in ETATS_EDITABLE and obj in klass.objects.mes_choses_a_faire(user).all()) or grp_drh in groupes_users:
286d0aa9
OL
19 return True
20 else:
21 return False
22