Replaced the hardcoded 'Area Director' approval role with a group-dependent list of approval roles. Fixes issue #1980.
- Legacy-Id: 11575
This commit is contained in:
parent
ac59a087cf
commit
8b6d8c9f44
|
@ -620,3 +620,14 @@ def format_timedelta(timedelta):
|
|||
@register.filter()
|
||||
def nbsp(value):
|
||||
return mark_safe(" ".join(value.split(' ')))
|
||||
|
||||
@register.filter()
|
||||
def comma_separated_list(seq, end_word="and"):
|
||||
if len(seq) < 2:
|
||||
return u"".join(seq)
|
||||
else:
|
||||
return u", ".join(seq[:-1]) + u" %s %s"%(end_word, seq[-1])
|
||||
|
||||
@register.filter()
|
||||
def role_names(roles):
|
||||
return list(set([ r.name.name for r in roles ]))
|
||||
|
|
|
@ -53,6 +53,9 @@ class GroupInfo(models.Model):
|
|||
kwargs["group_type"] = self.type_id
|
||||
return urlreverse(self.features.about_page, kwargs=kwargs)
|
||||
|
||||
def interim_approval_roles(self):
|
||||
return list(set([ role for role in self.parent.role_set.filter(name__in=['ad', 'chair']) ]))
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{% load ams_filters %}
|
||||
A new interim meeting {% if is_series %}series {% endif %}request has just been submitted by {{ requester }}.
|
||||
|
||||
This request requires approval by the Area Director.
|
||||
This request requires approval by the {{ group.interim_approval_roles|role_names|comma_separated_list:"or" }}
|
||||
|
||||
The meeting{{ meetings|pluralize }} can be approved here:
|
||||
{% for url in approval_urls %}{{ url }}
|
||||
{% endfor %}
|
||||
|
|
Loading…
Reference in a new issue