From b95439a8fb05d5c580c47688994621fa204517ac Mon Sep 17 00:00:00 2001 From: Stefan Foulis Date: Mon, 7 Mar 2016 09:19:57 +0100 Subject: [PATCH] fix infinite template recursion in Django 1.6 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. --- .../admin/filer/folder/directory_listing.html | 10 +++++++++- .../admin/filer/folder/folders_recursice.html | 12 ------------ 2 files changed, 9 insertions(+), 13 deletions(-) delete mode 100644 filer/templates/admin/filer/folder/folders_recursice.html diff --git a/filer/templates/admin/filer/folder/directory_listing.html b/filer/templates/admin/filer/folder/directory_listing.html index 9b22115b4..94dd9d810 100644 --- a/filer/templates/admin/filer/folder/directory_listing.html +++ b/filer/templates/admin/filer/folder/directory_listing.html @@ -108,7 +108,15 @@

 

Root - {% include "admin/filer/folder/folders_recursice.html" %} + {% for folder in folder.logical_path %} +
  • + + {% trans 'Folder Icon' %} + {{ folder.name }} + +
  • + {% endfor %} diff --git a/filer/templates/admin/filer/folder/folders_recursice.html b/filer/templates/admin/filer/folder/folders_recursice.html deleted file mode 100644 index cc85014af..000000000 --- a/filer/templates/admin/filer/folder/folders_recursice.html +++ /dev/null @@ -1,12 +0,0 @@ -{% load i18n staticfiles %} - -{% if folder.parent %} -
  • - - {% trans 'Folder Icon' %} - {{ folder.parent.name }} - -
  • - {% include "admin/filer/folder/folders_recursice.html" with folder=folder.parent %} -{% endif %}