Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wagtail 6.3 updates #503

Merged
merged 12 commits into from
Jan 2, 2025
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

Unreleased
==========

- Update the testing environment to test Wagtail 6.3 and Django 5.1
- Add conditional support for Wagtail 6.3 templates

4.0.1 (04.08.2024)
----------

Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ wagtailmenus is an extension for Torchbox's `Wagtail CMS <https://github.com/tor
The current version is tested for compatibility with the following:

- Wagtail versions >= 5.2
- Django versions 3.2, 4.2 and >= 5.0
- Python versions 3.8 to 3.12
- Django versions 4.2, 5.0 and >= 5.1
- Python versions 3.9 to 3.12

.. image:: https://raw.githubusercontent.com/jazzband/wagtailmenus/master/docs/source/_static/images/repeating-item.png

Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,21 @@
"Operating System :: OS Independent",
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Framework :: Django',
'Framework :: Django :: 3.2',
'Framework :: Django :: 4.2',
'Framework :: Django :: 5.0',
'Framework :: Django :: 5.1',
'Framework :: Wagtail :: 5',
'Framework :: Wagtail :: 6',
'Topic :: Internet :: WWW/HTTP',
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
],
install_requires=requires,
python_requires='>=3.8',
python_requires='>=3.9',
extras_require={
'testing': testing_extras,
'docs': documentation_extras,
Expand Down
13 changes: 7 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@ skipsdist = True
usedevelop = True

envlist =
wt52-dj32-py{38,39,310}
wt52-dj42-py{38,39,310,311,312}
wt52-dj42-py{39,310,311,312}
wt52-dj50-py{310,311,312}
wt60-dj42-py{38,39,310,311,312}
wt60-dj42-py{39,310,311,312}
wt60-dj50-py{310,311,312}
wt61-dj{42,50}-py{310,311,312}
wt62-dj{42,50}-py{310,311,312}
wt63-dj{42,50,51}-py{310,311,312}
wt63-dj51-py313

[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312
3.13: py313


[testenv]
Expand All @@ -27,11 +28,11 @@ commands = coverage run --source=wagtailmenus runtests.py

deps =
coverage
dj32: Django>=3.2,<4.0
dj41: Django>=4.1,<4.2
dj42: Django>=4.2,<4.3
dj50: Django>=5.0,<5.1
dj51: Django>=5.1,<5.2
wt52: wagtail>=5.2,<5.3
wt60: wagtail>=6.0,<6.1
wt61: wagtail>=6.1,<6.2
wt62: wagtail>=6.2,<6.3
wt63: wagtail>=6.3,<6.4
4 changes: 4 additions & 0 deletions wagtailmenus/menuadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,12 @@ class MainMenuAdmin(SnippetViewSet):

edit_view_class = MainMenuEditView
edit_template_name = "wagtailmenus/mainmenu_edit.html"
if WAGTAIL_VERSION < (6, 3):
MrCordeiro marked this conversation as resolved.
Show resolved Hide resolved
edit_template_name = "wagtailmenus/wagtail_before_63/mainmenu_edit.html"
error_message = _("The menu could not be saved due to errors.")

copy_view_enabled = False

edit_handler = TabbedInterface([
ObjectList(panels.main_menu_content_panels, heading=_("Content")),
ObjectList(panels.menu_settings_panels, heading=_("Settings"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{% extends 'wagtailmenus/includes/header.html' %}

{% block right_content %}
{% if site_switcher %}
<form method="get" id="settings-site-switch">
<label for="{{ site_switcher.site.id_for_label }}">
Site:
</label>
{{ site_switcher.site }}
</form>
{% endif %}
{% endblock %}
{% if site_switcher %}
<div class="w-field__wrapper " data-field-wrapper="">
<form method="get" id="settings-site-switch">
<label class="w-field__label" for="{{ site_switcher.site.id_for_label }}" id="{{ site_switcher.site.id_for_label }}-label">
Site: <span class="w-required-mark">*</span>
</label>
<div class="w-field__input" data-field-input="">
{{ site_switcher.site }}
</div>
</form>
</div>
{% endif %}
29 changes: 3 additions & 26 deletions wagtailmenus/templates/wagtailmenus/mainmenu_edit.html
Original file line number Diff line number Diff line change
@@ -1,34 +1,11 @@
{% extends "wagtailadmin/base.html" %}
{% extends "wagtailadmin/generic/edit.html" %}
{% load wagtailadmin_tags i18n %}
{% block titletag %}{% blocktrans trimmed with snippet_type_name=model_opts.verbose_name %}Editing {{ snippet_type_name }} - {{ object }}{% endblocktrans %}{% endblock %}
{% block bodyclass %}{% if locked_for_user %}content-locked{% endif %}{% endblock %}
{% block content %}
{% include 'wagtailadmin/shared/headers/slim_header.html' %}

{% block main_content %}
{% include "wagtailmenus/includes/header_with_site_switcher.html" with title=object icon=header_icon merged=1 %}

<div class="row row-flush">

<div class="{% if uc_enabled %}col10 divider-after{% else %}col12{% endif %}">
<form action="{{ action_url }}" method="POST" novalidate{% if form.is_multipart %} enctype="multipart/form-data"{% endif %} data-edit-form>
{% csrf_token %}
<div class="nice-padding">
{{ panel.render_form_content }}
</div>
<footer class="footer">
<nav aria-label="{% trans 'Actions' %}">
<ul>
<li class="actions actions--primary footer__container">
<div class="dropdown dropup dropdown-button match-width {% if view.view_name == 'revisions_revert' %}warning{% endif %}">
{{ action_menu.render_html }}
</div>
</li>
</ul>
</nav>
</footer>
</form>
</div>
</div>
{{ block.super }}
{% endblock %}

{% block extra_css %}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% extends 'wagtailmenus/includes/header.html' %}

{% block right_content %}
{% if site_switcher %}
<form method="get" id="settings-site-switch">
<label for="{{ site_switcher.site.id_for_label }}">
Site:
</label>
{{ site_switcher.site }}
</form>
{% endif %}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{% extends "wagtailadmin/base.html" %}
{% load wagtailadmin_tags i18n %}
{% block titletag %}{% blocktrans trimmed with snippet_type_name=model_opts.verbose_name %}Editing {{ snippet_type_name }} - {{ object }}{% endblocktrans %}{% endblock %}
{% block bodyclass %}{% if locked_for_user %}content-locked{% endif %}{% endblock %}
{% block content %}
{% include 'wagtailadmin/shared/headers/slim_header.html' %}

{% include "wagtailmenus/wagtail_before_63/includes/header_with_site_switcher.html" with title=object icon=header_icon merged=1 %}

<div class="row row-flush">

<div class="{% if uc_enabled %}col10 divider-after{% else %}col12{% endif %}">
<form action="{{ action_url }}" method="POST" novalidate{% if form.is_multipart %} enctype="multipart/form-data"{% endif %} data-edit-form>
{% csrf_token %}
<div class="nice-padding">
{{ panel.render_form_content }}
</div>
<footer class="footer">
<nav aria-label="{% trans 'Actions' %}">
<ul>
<li class="actions actions--primary footer__container">
<div class="dropdown dropup dropdown-button match-width {% if view.view_name == 'revisions_revert' %}warning{% endif %}">
{{ action_menu.render_html }}
</div>
</li>
</ul>
</nav>
</footer>
</form>
</div>
</div>
{% endblock %}

{% block extra_css %}
{{ block.super }}
{{ media.css }}
{{ view.media.css }}
{% endblock %}
{% block extra_js %}
{{ block.super }}
{% include "wagtailadmin/pages/_editor_js.html" %}
{{ media.js }}
{{ view.media.js }}

<script>
// Set wagtailConfig.ACTIVE_CONTENT_LOCALE if this is a translated page
// This value may be used by JS widgets on the form
{% if locale %}
window.wagtailConfig = window.wagtailConfig || {};
window.wagtailConfig.ACTIVE_CONTENT_LOCALE = '{{ locale.language_code|escapejs }}';
{% endif %}
</script>

{% if workflow_enabled %}
{% include "wagtailadmin/shared/_workflow_init.html" %}
{% endif %}
{% endblock %}
2 changes: 1 addition & 1 deletion wagtailmenus/tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_main_menu_save_success(self):
form = edit_view.forms[next(reversed(OrderedDict(edit_view.forms)))]
response = form.submit().follow()

assert re.search(r"Main menu [^<>]+ updated", response.content.decode())
assert re.search(r"Main menu .*? updated\.", response.content.decode())
github-advanced-security[bot] marked this conversation as resolved.
Dismissed
Show resolved Hide resolved


class LinkPageCMSTest(TestCase):
Expand Down
Loading