Skip to content

Commit

Permalink
fix infinite template recursion in Django 1.6
Browse files Browse the repository at this point in the history
Django 1.6 does not support including the same template in itself, even
if a conditional would prevent infinite recursion at runtime.
See https://code.djangoproject.com/ticket/3544

This solution is also more efficient, as it only causes one query
instead of at least n+1, where n is the folder depth.
  • Loading branch information
stefanfoulis committed Mar 7, 2016
1 parent a363d1d commit b95439a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
10 changes: 9 additions & 1 deletion filer/templates/admin/filer/folder/directory_listing.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,15 @@ <h2>&nbsp;</h2>
Root
</a>
</li>
{% include "admin/filer/folder/folders_recursice.html" %}
{% for folder in folder.logical_path %}
<li>
<a href="{% url 'admin:filer-directory_listing' folder.id %}{% if is_popup %}?_popup=1{% if select_folder %}&amp;select_folder=1{% endif %}{% endif %}"
title="{% trans 'Go back to the parent folder' %}">
<img src="{% static 'icons/plainfolder_48x48.png' %}" alt="{% trans 'Folder Icon' %}" width="28" height="28">
{{ folder.name }}
</a>
</li>
{% endfor %}
</ul>
</div>

Expand Down
12 changes: 0 additions & 12 deletions filer/templates/admin/filer/folder/folders_recursice.html

This file was deleted.

0 comments on commit b95439a

Please sign in to comment.