Skip to content

Commit f5c4616

Browse files
authored
Merge branch 'develop' into fix/gh-7654-sideframe-hsitory-nav-button-wrap
2 parents 621c76e + 822f54b commit f5c4616

File tree

26 files changed

+204
-241
lines changed

26 files changed

+204
-241
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Docs
22

3-
on: [push, pull_request]
3+
on: pull_request
44

55
concurrency:
66
group: ${{ github.workflow }}-${{ github.ref }}

.github/workflows/frontend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: django CMS frontend.yml
22

3-
on: [push, pull_request]
3+
on: pull_request
44

55
concurrency:
66
group: ${{ github.workflow }}-${{ github.ref }}

.github/workflows/lint-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ jobs:
1515
name: Validate PR title
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: amannn/action-semantic-pull-request@v4
18+
- uses: amannn/action-semantic-pull-request@v5.4.0
1919
env:
2020
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/linters.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: django CMS linters.yml
22

3-
on: [push, pull_request]
3+
on: pull_request
44

55
concurrency:
66
group: ${{ github.workflow }}-${{ github.ref }}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: New contributor message
2+
3+
on:
4+
pull_request_target:
5+
types: [opened]
6+
7+
permissions:
8+
pull-requests: write
9+
10+
jobs:
11+
build:
12+
name: Hello new contributor
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/first-interaction@v1
16+
with:
17+
repo-token: ${{ secrets.GITHUB_TOKEN }}
18+
pr-message: |
19+
Hello! Thank you for your contribution! 🎉
20+
21+
As it's your first contribution be sure to check out the [contribution docs](https://docs.django-cms.org/en/latest/contributing/index.html).
22+
23+
If you're a Slack user and haven't joined us, please do [here](https://www.django-cms.org/slack)!
24+
25+
Welcome aboard ⛵️!

.github/workflows/releases.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Comment on PRs into release/* branches
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened]
6+
branches:
7+
- release/*
8+
9+
jobs:
10+
comment:
11+
runs-on: ubuntu-latest
12+
continue-on-error: true
13+
steps:
14+
- name: Comment on PR
15+
uses: actions/github-script@v7
16+
with:
17+
github-token: ${{secrets.GITHUB_TOKEN}}
18+
script: |
19+
try { github.rest.issues.createComment({
20+
issue_number: context.issues.number,
21+
owner: context.repo.owner,
22+
repo: context.repo.repo,
23+
body: '👋 Hi there!\n\nPlease remember to **MERGE COMMIT** pull requests from `develop` or `develop-4`!\n\n**Do not SQUASH** commits to preserve history for the changelog.'
24+
}) } catch(e) { console.log(e) }

.github/workflows/test.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
name: django CMS test.yml
22

3-
on: [push, pull_request]
3+
on: pull_request
44

55
concurrency:
66
group: ${{ github.workflow }}-${{ github.ref }}
77
cancel-in-progress: true
88

99
jobs:
10-
database-postgres:
10+
postgres:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
fail-fast: false
@@ -18,10 +18,16 @@ jobs:
1818
django-4.0.txt,
1919
django-4.1.txt,
2020
django-4.2.txt,
21+
django-5.0.txt
2122
]
2223
os: [
2324
ubuntu-20.04,
2425
]
26+
exclude:
27+
- requirements-file: django-5.0.txt
28+
python-version: 3.8
29+
- requirements-file: django-5.0.txt
30+
python-version: 3.9
2531

2632
services:
2733
postgres:
@@ -59,7 +65,7 @@ jobs:
5965
DATABASE_URL: postgres://postgres:postgres@127.0.0.1/postgres
6066

6167

62-
database-mysql:
68+
mysql:
6369
runs-on: ${{ matrix.os }}
6470
strategy:
6571
fail-fast: false
@@ -70,10 +76,16 @@ jobs:
7076
django-4.0.txt,
7177
django-4.1.txt,
7278
django-4.2.txt,
79+
django-5.0.txt
7380
]
7481
os: [
7582
ubuntu-20.04,
7683
]
84+
exclude:
85+
- requirements-file: django-5.0.txt
86+
python-version: 3.8
87+
- requirements-file: django-5.0.txt
88+
python-version: 3.9
7789

7890
services:
7991
mysql:
@@ -111,7 +123,7 @@ jobs:
111123
env:
112124
DATABASE_URL: mysql://root@127.0.0.1/djangocms_test
113125

114-
database-sqlite:
126+
sqlite:
115127
runs-on: ${{ matrix.os }}
116128
strategy:
117129
fail-fast: false
@@ -122,10 +134,16 @@ jobs:
122134
django-4.0.txt,
123135
django-4.1.txt,
124136
django-4.2.txt,
137+
django-5.0.txt
125138
]
126139
os: [
127140
ubuntu-20.04,
128141
]
142+
exclude:
143+
- requirements-file: django-5.0.txt
144+
python-version: 3.8
145+
- requirements-file: django-5.0.txt
146+
python-version: 3.9
129147

130148
steps:
131149
- uses: actions/checkout@v3

cms/cms_toolbars.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from cms.toolbar_base import CMSToolbar
1717
from cms.toolbar_pool import toolbar_pool
1818
from cms.utils import get_language_from_request, page_permissions
19+
from cms.utils.compat import DJANGO_4_2
1920
from cms.utils.conf import get_cms_setting
2021
from cms.utils.i18n import get_language_dict, get_language_tuple
2122
from cms.utils.page_permissions import user_can_change_page, user_can_delete_page, user_can_publish_page
@@ -225,7 +226,7 @@ def add_logout_button(self, parent):
225226
action=admin_reverse('logout'),
226227
active=True,
227228
on_success=on_success,
228-
method='GET',
229+
method='GET' if DJANGO_4_2 else 'POST',
229230
)
230231

231232
def add_language_menu(self):

cms/forms/fields.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
from django import forms
22
from django.contrib.admin.widgets import RelatedFieldWidgetWrapper
33
from django.core.validators import EMPTY_VALUES
4+
from django.forms import ChoiceField
45
from django.utils.translation import gettext_lazy as _
56

67
from cms.forms.utils import get_page_choices, get_site_choices
78
from cms.forms.validators import validate_url_extra
89
from cms.forms.widgets import PageSelectWidget, PageSmartLinkWidget
910
from cms.models.pagemodel import Page
11+
from cms.utils.compat import DJANGO_4_2
1012

1113

1214
class SuperLazyIterator:
@@ -18,11 +20,20 @@ def __iter__(self):
1820

1921

2022
class LazyChoiceField(forms.ChoiceField):
21-
def _set_choices(self, value):
22-
# we overwrite this function so no list(value) is called
23-
self._choices = self.widget.choices = value
2423

25-
choices = property(forms.ChoiceField._get_choices, _set_choices)
24+
25+
@property
26+
def choices(self):
27+
return super().choices()
28+
29+
@choices.setter
30+
def choices(self, value):
31+
# we overwrite this function so no list(value) or normalize_choices(value) is called
32+
# also, do not call the widget's setter as of Django 5
33+
if DJANGO_4_2:
34+
self._choices = self.widget.choices = value
35+
else:
36+
self._choices = self.widget._choices = value
2637

2738

2839
class PageSelectFormField(forms.MultiValueField):
@@ -38,14 +49,12 @@ def __init__(self, queryset=None, empty_label="---------", cache_choices=False,
3849
errors = self.default_error_messages.copy()
3950
if 'error_messages' in kwargs:
4051
errors.update(kwargs['error_messages'])
41-
site_choices = SuperLazyIterator(get_site_choices)
42-
page_choices = SuperLazyIterator(get_page_choices)
4352
self.limit_choices_to = limit_choices_to
4453
kwargs['required'] = required
4554
kwargs.pop('blank', None)
4655
fields = (
47-
LazyChoiceField(choices=site_choices, required=False, error_messages={'invalid': errors['invalid_site']}),
48-
LazyChoiceField(choices=page_choices, required=False, error_messages={'invalid': errors['invalid_page']}),
56+
ChoiceField(choices=get_site_choices, required=False, error_messages={'invalid': errors['invalid_site']}),
57+
ChoiceField(choices=get_page_choices, required=False, error_messages={'invalid': errors['invalid_page']}),
4958
)
5059
super().__init__(fields, *args, **kwargs)
5160

cms/management/commands/subcommands/tree.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,24 @@ def get_descendants(root):
2222

2323

2424
class FixTreeCommand(SubcommandsCommand):
25-
help_string = 'Repairing Materialized Path Tree for Pages'
25+
help_string = 'Repairing Materialized Path Tree for Pages and Plugins'
2626
command_name = 'fix-tree'
2727

28+
def add_arguments(self, parser):
29+
parser.add_argument(
30+
'--fix-paths',
31+
action='store_true',
32+
default=False,
33+
help='Fix paths for pages and plugins - takes a long time',
34+
)
35+
2836
def handle(self, *args, **options):
2937
"""
3038
Repairs the tree
3139
"""
40+
fix_paths = options.get('fix_paths', False)
3241
self.stdout.write('fixing page tree')
33-
TreeNode.fix_tree()
42+
TreeNode.fix_tree(fix_paths=fix_paths)
3443

3544
root_nodes = TreeNode.objects.filter(parent__isnull=True)
3645

@@ -54,7 +63,7 @@ def handle(self, *args, **options):
5463
self._update_descendants_tree(root)
5564

5665
self.stdout.write('fixing plugin tree')
57-
CMSPlugin.fix_tree()
66+
CMSPlugin.fix_tree(fix_paths=fix_paths)
5867
self.stdout.write('all done')
5968

6069
def _update_descendants_tree(self, root):

0 commit comments

Comments
 (0)