{% extends 'generic/object.html' %}

{% block breadcrumbs %}
  {{ block.super }}
  {% if object.region %}
    {% for region in object.region.get_ancestors %}
      <li class="breadcrumb-item"><a href="{% url 'dcim:site_list' %}?region_id={{ region.pk }}">{{ region }}</a></li>
    {% endfor %}
    <li class="breadcrumb-item"><a href="{% url 'dcim:site_list' %}?region_id={{ object.region.pk }}">{{ object.region }}</a></li>
  {% elif object.group %}
    {% for group in object.group.get_ancestors %}
      <li class="breadcrumb-item"><a href="{% url 'dcim:site_list' %}?group_id={{ group.pk }}">{{ group }}</a></li>
    {% endfor %}
    <li class="breadcrumb-item"><a href="{% url 'dcim:site_list' %}?group_id={{ object.group.pk }}">{{ object.group }}</a></li>
  {% endif %}
{% endblock %}
