+# -*- encoding: utf-8 -*-
+
+import os
+
from django import template
from project.dae.workflow import ETATS_EDITABLE
from project.dae.workflow import grp_correspondants_rh, grp_administrateurs, grp_drh
def est_editable(obj, user):
klass = obj.__class__
groupes_users = user.groups.all()
- if (obj.etat in ETATS_EDITABLE and obj in klass.objects.mes_choses_a_faire(user).all()) or grp_drh in groupes_users:
+ if obj.etat in ETATS_EDITABLE and \
+ (obj in klass.objects.mes_choses_a_faire(user).all() or grp_drh in groupes_users):
return True
else:
return False
+@register.filter
+def region_ou_service(implantation):
+ if implantation.id == 15:
+ return u"Services centraux de Montréal (SCM)"
+ if implantation.id == 19:
+ return u"Services centraux de Paris (SCP)"
+ return implantation.region
+
+@register.filter
+def basename(path):
+ return os.path.basename(path)