From 959d62c4f186580d7555f77d3d6b11abd03a7739 Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Sun, 19 May 2024 15:39:39 +0200 Subject: [PATCH] Fix issue #1470 --- .github/workflows/test.yml | 4 +--- filer/models/filemodels.py | 15 ++++++++++----- .../admin/filer/folder/directory_table_list.html | 2 +- tests/test_admin.py | 1 + 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bf6464912..072c7e130 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,11 +10,9 @@ jobs: matrix: python-version: ['3.8', '3.9', '3.10', '3.11'] requirements-file: [ - django-3.2.txt, - django-4.0.txt, - django-4.1.txt, django-4.2.txt, django-5.0.txt, + django-5.1.txt, ] custom-image-model: [false, true] exclude: diff --git a/filer/models/filemodels.py b/filer/models/filemodels.py index 38f9a98f4..595b262e0 100644 --- a/filer/models/filemodels.py +++ b/filer/models/filemodels.py @@ -344,19 +344,24 @@ def has_generic_permission(self, request, permission_type): else: return False - def get_admin_change_url(self): + def get_admin_url(self, action): return reverse( - 'admin:{}_{}_change'.format( + 'admin:{}_{}_{}'.format( self._meta.app_label, self._meta.model_name, + action ), args=(self.pk,) ) + def get_admin_change_url(self): + return self.get_admin_url("change") + + def get_admin_expand_view_url(self): + return self.get_admin_url("expand") + def get_admin_delete_url(self): - return reverse( - f'admin:{self._meta.app_label}_{self._meta.model_name}_delete', - args=(self.pk,)) + return self.get_admin_url("delete") @property def url(self): diff --git a/filer/templates/admin/filer/folder/directory_table_list.html b/filer/templates/admin/filer/folder/directory_table_list.html index dd0cc5c67..e3da329dd 100644 --- a/filer/templates/admin/filer/folder/directory_table_list.html +++ b/filer/templates/admin/filer/folder/directory_table_list.html @@ -139,7 +139,7 @@ {% if file.canonical_url %} - """