Implemented recursive regions with django-mptt

This commit is contained in:
Jeremy Stretch
2017-02-28 14:15:15 -05:00
parent f3b9930dea
commit 9313ba08ed
11 changed files with 80 additions and 26 deletions

View File

@@ -9,9 +9,11 @@
<div class="row">
<div class="col-sm-8 col-md-9">
<ol class="breadcrumb">
<li><a href="{% url 'dcim:site_list' %}">Sites</a></li>
{% if site.region %}
<li> <a href="{{ site.region.get_absolute_url }}">{{ site.region }}</a></li>
{% for region in site.region.get_ancestors %}
<li><a href="{{ region.get_absolute_url }}">{{ region }}</a></li>
{% endfor %}
<li><a href="{{ site.region.get_absolute_url }}">{{ site.region }}</a></li>
{% endif %}
<li>{{ site }}</li>
</ol>
@@ -62,6 +64,10 @@
<td>Region</td>
<td>
{% if site.region %}
{% for region in site.region.get_ancestors %}
<a href="{{ region.get_absolute_url }}">{{ region }}</a>
<i class="fa fa-angle-right"></i>
{% endfor %}
<a href="{{ site.region.get_absolute_url }}">{{ site.region }}</a>
{% else %}
<span class="text-muted">None</span>