{% load rules %}

<div class="collection person-collection">
  {% for person in persons %}
    <a class="collection-item avatar waves-effect" href="{% url "person_by_id" person.pk %}">
      {% has_perm 'core.view_photo_rule' user person as can_view_photo %}
      {% if person.photo and can_view_photo %}
        <img class="circle" src="{{ person.photo.url }}"
             alt="{{ person.first_name }} {{ person.last_name }}"/>
      {% else %}
        <i class="material-icons materialize-circle">person</i>
      {% endif %}
      {{ person }}
    </a>
  {% endfor %}
</div>
