Permalink
Browse files

Show custom or default message for empty permission sets

  • Loading branch information...
1 parent 3f8736a commit 917abee26a31324a9b674b358adce483191ec3e1 Andreas Knab committed Jan 10, 2012
@@ -11,5 +11,7 @@
{% if ac.user %}<img src="{% url static 'images/user.png' %}" alt="User" class="user-icon" />
<a href="{% url access-effective-permissions contenttype.app_label, contenttype.model, object.id, object.name %}?user={{ ac.user.username|urlencode }}">{{ ac.user.username }}</a>
{% else %}{% if ac.usergroup %}<img src="{% url static 'images/group.png' %}" alt="Group" class="user-icon" /> {{ ac.usergroup.name }}{% else %}Anonymous Users{% endif %}{% endif %}<br />
+{% empty %}
+{{ emptymessage|default:"No permissions set." }}
{% endfor %}
</div>
@@ -17,11 +17,12 @@ def effective_permissions_form(context, object):
@register.inclusion_tag('access_permissions_display.html', takes_context=True)
-def permissions_display(context, object):
+def permissions_display(context, object, emptymessage=None):
permissions = get_accesscontrols_for_object(object)
return {'object': object,
'contenttype': ContentType.objects.get_for_model(object.__class__),
'permissions': permissions,
+ 'emptymessage': emptymessage,
'request': context['request'],
}

0 comments on commit 917abee

Please sign in to comment.