diff --git a/apps/common/utils.py b/apps/common/utils.py index 6f5a933ae3..32db044fc0 100644 --- a/apps/common/utils.py +++ b/apps/common/utils.py @@ -105,14 +105,18 @@ def pretty_size_10(size): def exists_with_famfam(path): try: - if os.path.exists(path): - return u'' - else: - return u'' + return two_state_template(os.path.exists(path)) except Exception, exc: return exc +def two_state_template(state, famfam_ok_icon=u'tick', famfam_fail_icon=u'cross'): + if state: + return u'' % famfam_ok_icon + else: + return u'' % famfam_fail_icon + + # The code here is based loosely on John Cardinal's notes found at: # http://www.johncardinal.com/tmgutil/capitalizenames.htm diff --git a/apps/user_management/views.py b/apps/user_management/views.py index b63c90666e..193eba6b3a 100644 --- a/apps/user_management/views.py +++ b/apps/user_management/views.py @@ -10,7 +10,7 @@ from django.contrib.contenttypes.models import ContentType from permissions.api import check_permissions from common.forms import ChoiceForm -from common.utils import generate_choices_w_labels +from common.utils import generate_choices_w_labels, two_state_template from user_management import PERMISSION_USER_VIEW, \ PERMISSION_USER_EDIT, PERMISSION_USER_CREATE, \ @@ -40,7 +40,7 @@ def user_list(request): 'attribute': 'email' }, { 'name': _(u'active'), - 'attribute': 'is_active' + 'attribute': lambda x: two_state_template(x.is_active), } ],