Skip to content

Commit 009535b

Browse files
authored
Merge branch 'master' into feat/cms-5.1-support
2 parents 7290c47 + 772e8ac commit 009535b

17 files changed

+35
-32
lines changed

.github/workflows/codeql.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ jobs:
2424

2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@v5
27+
uses: actions/checkout@v6
2828

2929
- name: Initialize CodeQL
30-
uses: github/codeql-action/init@v3
30+
uses: github/codeql-action/init@v4
3131
with:
3232
languages: ${{ matrix.language }}
3333
queries: +security-and-quality
3434

3535
- name: Autobuild
36-
uses: github/codeql-action/autobuild@v3
36+
uses: github/codeql-action/autobuild@v4
3737
if: ${{ matrix.language == 'javascript' || matrix.language == 'python' }}
3838

3939
- name: Perform CodeQL Analysis
40-
uses: github/codeql-action/analyze@v3
40+
uses: github/codeql-action/analyze@v4
4141
with:
4242
category: "/language:${{ matrix.language }}"

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@v5
12+
- uses: actions/checkout@v6
1313

1414
- run: python -Im pip install --user ruff
1515

.github/workflows/publish-to-live-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
permissions:
1616
id-token: write
1717
steps:
18-
- uses: actions/checkout@v5
18+
- uses: actions/checkout@v6
1919
- name: Set up Python 3.10
2020
uses: actions/setup-python@v6
2121
with:

.github/workflows/publish-to-test-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
permissions:
1616
id-token: write
1717
steps:
18-
- uses: actions/checkout@v5
18+
- uses: actions/checkout@v6
1919
- name: Set up Python 3.10
2020
uses: actions/setup-python@v6
2121
with:

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- '3.13'
2121

2222
steps:
23-
- uses: actions/checkout@v5
23+
- uses: actions/checkout@v6
2424

2525
- name: Set up Python ${{ matrix.python-version }}
2626
uses: actions/setup-python@v6
@@ -49,7 +49,7 @@ jobs:
4949
runs-on: ubuntu-latest
5050
needs: unit-tests
5151
steps:
52-
- uses: actions/checkout@v5
52+
- uses: actions/checkout@v6
5353

5454
- uses: actions/setup-python@v6
5555
with:
@@ -93,7 +93,7 @@ jobs:
9393
]
9494

9595
steps:
96-
- uses: actions/checkout@v5
96+
- uses: actions/checkout@v6
9797
- name: Set up Python ${{ matrix.python-version }}
9898

9999
uses: actions/setup-python@v6

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ci:
99

1010
repos:
1111
- repo: https://github.com/asottile/pyupgrade
12-
rev: v3.21.0
12+
rev: v3.21.2
1313
hooks:
1414
- id: pyupgrade
1515
args: ["--py38-plus"]
@@ -21,7 +21,7 @@ repos:
2121
args: [--target-version, "3.2"]
2222

2323
- repo: https://github.com/astral-sh/ruff-pre-commit
24-
rev: v0.14.3
24+
rev: v0.14.7
2525
hooks:
2626
- id: ruff
2727
args: [--fix, --exit-non-zero-on-fix]

djangocms_alias/admin.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import annotations
22

3+
from collections.abc import Iterable
4+
35
from cms.admin.utils import GrouperModelAdmin
46
from cms.utils.permissions import get_model_permission_codename
57
from cms.utils.urlutils import admin_reverse
@@ -16,7 +18,6 @@
1618
from django.utils.translation import gettext_lazy as _
1719
from parler.admin import TranslatableAdmin
1820

19-
from .cms_config import AliasCMSConfig
2021
from .constants import (
2122
CHANGE_ALIAS_URL_NAME,
2223
DELETE_ALIAS_URL_NAME,
@@ -37,13 +38,6 @@
3738
"AliasContentAdmin",
3839
]
3940

40-
alias_admin_list_display = ["content__name", "category", "static", "used", "admin_list_actions"]
41-
djangocms_versioning_enabled = AliasCMSConfig.djangocms_versioning_enabled
42-
43-
if djangocms_versioning_enabled:
44-
alias_admin_list_display.insert(-1, "get_author")
45-
alias_admin_list_display.insert(-1, "get_modified_date")
46-
4741

4842
@admin.register(Category)
4943
class CategoryAdmin(TranslatableAdmin):
@@ -64,7 +58,7 @@ def save_model(self, request, obj, form, change):
6458

6559
@admin.register(Alias)
6660
class AliasAdmin(GrouperModelAdmin):
67-
list_display = alias_admin_list_display
61+
list_display = ["content__name", "category", "static", "used", "admin_list_actions"]
6862
list_display_links = None
6963
list_filter = (
7064
SiteFilter,
@@ -82,11 +76,20 @@ def get_actions_list(self) -> list:
8276
"""Add alias usage list actions"""
8377
return super().get_actions_list() + [self._get_alias_usage_link, self._get_alias_delete_link]
8478

85-
def get_queryset(self, request):
79+
def get_queryset(self, request: HttpRequest) -> models.QuerySet:
8680
qs = super().get_queryset(request)
8781
# Annotate each Alias with a boolean indicating if related cmsplugins exist
8882
return qs.annotate(cmsplugins_count=models.Count("cms_plugins"))
8983

84+
def get_list_display(self, request: HttpRequest) -> Iterable[str]:
85+
list_display = super().get_list_display(request)
86+
list_display = list(list_display)
87+
if hasattr(self, "get_author"):
88+
list_display.insert(-1, "get_author")
89+
if hasattr(self, "get_modified_date"):
90+
list_display.insert(-1, "get_modified_date")
91+
return list_display
92+
9093
@admin.display(description=_("Used"), boolean=True, ordering="cmsplugins_count")
9194
def used(self, obj: Alias) -> bool | None:
9295
if obj.static_code and obj.cmsplugins_count == 0:

tests/requirements/py311-dj52-cms50-default.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ coverage[toml]==7.8.0
1414
# via
1515
# -r requirements.in
1616
# pytest-cov
17-
django==5.2.8
17+
django==5.2.9
1818
# via
1919
# django-classy-tags
2020
# django-cms

tests/requirements/py311-dj52-cms50-versioning.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ coverage[toml]==7.8.0
1414
# via
1515
# -r requirements.in
1616
# pytest-cov
17-
django==5.2.8
17+
django==5.2.9
1818
# via
1919
# django-classy-tags
2020
# django-cms

tests/requirements/py312-dj52-cms50-default.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ coverage[toml]==7.8.0
1414
# via
1515
# -r requirements.in
1616
# pytest-cov
17-
django==5.2.8
17+
django==5.2.9
1818
# via
1919
# django-classy-tags
2020
# django-cms

0 commit comments

Comments
 (0)