Added extra check for object when sorting self-referential models.

master
Brandon Taylor 2014-11-03 10:44:11 -05:00
parent 612c4f8031
commit e521d5c8ad
1 changed files with 18 additions and 15 deletions

View File

@ -3,14 +3,15 @@
{% if regrouped_objects %} {% if regrouped_objects %}
<ul {% if sortable_by_class_is_sortable %}class="sortable"{% endif %}> <ul {% if sortable_by_class_is_sortable %}class="sortable"{% endif %}>
{% for regrouped_object in regrouped_objects %} {% for regrouped_object in regrouped_objects %}
<li>
{% with object=regrouped_object.grouper %} {% with object=regrouped_object.grouper %}
{% if object %}
<li>
{% if sortable_by_class_is_sortable %} {% if sortable_by_class_is_sortable %}
{% render_object_rep object %} {% render_object_rep object %}
{% else %} {% else %}
{{ object }} {{ object }}
{% endif %} {% endif %}
{% endwith %}
{% if regrouped_object.list %} {% if regrouped_object.list %}
{% with regrouped_object_list_length=regrouped_object.list|length %} {% with regrouped_object_list_length=regrouped_object.list|length %}
<ul {% if regrouped_object_list_length > 1 %}class="sortable"{% endif %}> <ul {% if regrouped_object_list_length > 1 %}class="sortable"{% endif %}>
@ -19,6 +20,8 @@
{% endwith %} {% endwith %}
{% endif %} {% endif %}
</li> </li>
{% endif %}
{% endwith %}
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %} {% endif %}