{% with relationships=object.get_relationships_data %} {% if relationships.source or relationships.destination %}
Relationships
{% for side, relationships in relationships.items %} {% for relationship, value in relationships.items %} {% if not value.has_many and value.value %} {% elif value.has_many and value.queryset.count %} {% else %} {% endif %} {% endfor %} {% endfor %}
{{ value.label }} {{ value.value }} {{ value.queryset.count }}
{% endif %} {% endwith %}