From accd80c99e0eb01aeeb79b6b089a1551eaf0ece1 Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Fri, 7 Jul 2023 21:12:23 +0200 Subject: [PATCH 1/5] Fix #1377 --- filer/models/foldermodels.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filer/models/foldermodels.py b/filer/models/foldermodels.py index a9c1e851e..54fa9c5a4 100644 --- a/filer/models/foldermodels.py +++ b/filer/models/foldermodels.py @@ -6,7 +6,7 @@ from django.urls import reverse from django.utils.functional import cached_property from django.utils.html import format_html, format_html_join -from django.utils.translation import gettext as _ +from django.utils.translation import gettext_lazy as _ from .. import settings as filer_settings from . import mixins From 959d62c4f186580d7555f77d3d6b11abd03a7739 Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Sun, 19 May 2024 15:39:39 +0200 Subject: [PATCH 2/5] 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 %} - """ From 76a5998189f9efad9c391306c498171d47c51125 Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Sun, 19 May 2024 15:48:18 +0200 Subject: [PATCH 3/5] Update tests --- .github/workflows/test.yml | 9 ++------- tests/requirements/django-main.txt | 4 ++++ tox.ini | 10 ++++------ 3 files changed, 10 insertions(+), 13 deletions(-) create mode 100644 tests/requirements/django-main.txt diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 072c7e130..136b3ef29 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,18 +8,13 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.10', '3.11', '3.12'] requirements-file: [ django-4.2.txt, django-5.0.txt, - django-5.1.txt, + django-main.txt, ] custom-image-model: [false, true] - exclude: - - requirements-file: django-5.0.txt - python-version: 3.8 - - requirements-file: django-5.0.txt - python-version: 3.9 os: [ ubuntu-20.04, ] diff --git a/tests/requirements/django-main.txt b/tests/requirements/django-main.txt new file mode 100644 index 000000000..c35200e8f --- /dev/null +++ b/tests/requirements/django-main.txt @@ -0,0 +1,4 @@ +-r base.txt + +git+https://github.com/django/django@main#egg=Django +django_polymorphic>=3.1 diff --git a/tox.ini b/tox.ini index f81e1db80..3c02bbec8 100644 --- a/tox.ini +++ b/tox.ini @@ -4,9 +4,8 @@ envlist = isort docs frontend - py{38,39,310}-dj32-{swap,noswap} - py{38,39,310,311}-{dj40,dj41,dj42}-{swap,noswap} - py{310,311}-{dj50}-{swap,noswap} +# py{38,39,310,311}-{dj42}-{swap,noswap} + py{310,311,312}-{dj50,dj51}-{swap,noswap} [gh-actions] python = @@ -14,16 +13,15 @@ python = 3.9: py39 3.10: py310 3.11: py311 + 3.12: py312 skip_missing_interpreters=True [testenv] deps = - dj32: -r tests/requirements/django-3.2.txt - dj40: -r tests/requirements/django-4.0.txt - dj41: -r tests/requirements/django-4.1.txt dj42: -r tests/requirements/django-4.2.txt dj50: -r tests/requirements/django-5.0.txt + dj51: -r tests/requirements/django-5.1.txt commands = {envpython} --version {env:COMMAND:coverage} erase From 5241119d2f6fee6baf4f3ee69c1681bf1517e142 Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Sun, 19 May 2024 16:31:25 +0200 Subject: [PATCH 4/5] Update `tox.ini` --- tox.ini | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tox.ini b/tox.ini index 3c02bbec8..33401c0bf 100644 --- a/tox.ini +++ b/tox.ini @@ -4,13 +4,10 @@ envlist = isort docs frontend -# py{38,39,310,311}-{dj42}-{swap,noswap} - py{310,311,312}-{dj50,dj51}-{swap,noswap} + py{310,311,312}-{dj42,dj50,djmain}-{swap,noswap} [gh-actions] python = - 3.8: py38 - 3.9: py39 3.10: py310 3.11: py311 3.12: py312 @@ -18,10 +15,13 @@ python = skip_missing_interpreters=True [testenv] +allowlist_externals = + {env:COMMAND:coverage} + {envpython} deps = dj42: -r tests/requirements/django-4.2.txt dj50: -r tests/requirements/django-5.0.txt - dj51: -r tests/requirements/django-5.1.txt + dj5main: -r tests/requirements/django-main.txt commands = {envpython} --version {env:COMMAND:coverage} erase From 89941c15331f201d313abd7884628fbe1517c705 Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Sun, 19 May 2024 18:44:58 +0200 Subject: [PATCH 5/5] Update tox.ini Co-authored-by: Mark Walker --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 33401c0bf..d04a03bd2 100644 --- a/tox.ini +++ b/tox.ini @@ -21,7 +21,7 @@ allowlist_externals = deps = dj42: -r tests/requirements/django-4.2.txt dj50: -r tests/requirements/django-5.0.txt - dj5main: -r tests/requirements/django-main.txt + djmain: -r tests/requirements/django-main.txt commands = {envpython} --version {env:COMMAND:coverage} erase