Renumber Wagtail 2.17 to 3.0

As per discussion on https://github.com/wagtail/wagtail/discussions/7732, the changes in the upcoming release (sidebar redesign, removal of hallo.js, module reorganisation) warrant a version bump to 3.0 if we're following semantic versioning.
pull/8006/head
Matt Westcott 2022-03-30 15:13:18 +01:00 zatwierdzone przez LB (Ben Johnston)
rodzic ff18b4c303
commit 97e781e31c
19 zmienionych plików z 44 dodań i 44 usunięć

Wyświetl plik

@ -1,8 +1,8 @@
Changelog
=========
2.17 (xx.xx.xxxx) - IN DEVELOPMENT
~~~~~~~~~~~~~~~~~
3.0 (xx.xx.xxxx) - IN DEVELOPMENT
~~~~~~~~~~~~~~~~
* Phase out special-purpose panel types (`StreamFieldPanel`, `RichTextFieldPanel`, `ImageChooserPanel`, `DocumentChooserPanel`, `PageChooserPanel`, `SnippetChooserPanel`) in favour of `FieldPanel` (Matt Westcott)
* Upgrade ESLint and Stylelint configurations to latest shared Wagtail configs (Thibaud Colas, Paarth Agarwal)

Wyświetl plik

@ -28,7 +28,7 @@
}
// Backwards-compatibility for branding_logo customisations in legacy sidebar.
//RemovedInWagtail218Warning Remove when removing the legacy sidebar.
//RemovedInWagtail40Warning Remove when removing the legacy sidebar.
.wagtail-logo-container__mobile {
margin-inline-end: 10px;
background-color: #555;

Wyświetl plik

@ -528,7 +528,7 @@ Database fields
This field contains the JSON content for the page at the time the revision was created
.. versionchanged:: 2.17
.. versionchanged:: 3.0
The field has been renamed from ``content_json`` to ``content`` and it now uses :class:`~django.db.models.JSONField` instead of
:class:`~django.db.models.TextField`.
@ -992,7 +992,7 @@ Database fields
The JSON representation of any additional details for each action.
e.g. source page id and title when copying from a page. Or workflow id/name and next step id/name on a workflow transition
.. versionchanged:: 2.17
.. versionchanged:: 3.0
The field has been renamed from ``data_json`` to ``data`` and it now uses :class:`~django.db.models.JSONField` instead of
:class:`~django.db.models.TextField`.

Wyświetl plik

@ -55,7 +55,7 @@ StreamFieldPanel
Deprecated; use ``FieldPanel`` instead.
.. versionchanged:: 2.17
.. versionchanged:: 3.0
``StreamFieldPanel`` is no longer required for ``StreamField``.
@ -166,7 +166,7 @@ PageChooserPanel
Passing ``can_choose_root=True`` will allow the editor to choose the tree root as a page. Normally this would be undesirable, since the tree root is never a usable page, but in some specialised cases it may be appropriate; for example, a page with an automatic "related articles" feed could use a PageChooserPanel to select which subsection articles will be taken from, with the root corresponding to 'everywhere'.
.. versionchanged:: 2.17
.. versionchanged:: 3.0
``FieldPanel`` now also provides a page chooser interface for foreign keys to page models. ``PageChooserPanel`` is only required when specifying the ``page_type`` or ``can_choose_root`` parameters.
@ -180,7 +180,7 @@ ImageChooserPanel
Deprecated; use ``FieldPanel`` instead.
.. versionchanged:: 2.17
.. versionchanged:: 3.0
``ImageChooserPanel`` is no longer required to obtain an image chooser interface.
@ -214,7 +214,7 @@ DocumentChooserPanel
Deprecated; use ``FieldPanel`` instead.
.. versionchanged:: 2.17
.. versionchanged:: 3.0
``DocumentChooserPanel`` is no longer required to obtain a document chooser interface.
@ -228,7 +228,7 @@ SnippetChooserPanel
Deprecated; use ``FieldPanel`` instead.
.. versionchanged:: 2.17
.. versionchanged:: 3.0
``SnippetChooserPanel`` is no longer required to obtain a document chooser interface.

Wyświetl plik

@ -18,7 +18,7 @@ This document details the block types provided by Wagtail for use in :ref:`Strea
:param block_counts: Specifies the minimum and maximum number of each block type, as a dictionary mapping block names to dicts with (optional) ``min_num`` and ``max_num`` fields.
:param collapsed: When true, all blocks are initially collapsed.
.. versionchanged:: 2.17
.. versionchanged:: 3.0
The required ``use_json_field`` argument is added.
.. code-block:: python

Wyświetl plik

@ -1,4 +1,4 @@
# Wagtail 2.17 release notes - IN DEVELOPMENT
# Wagtail 3.0 release notes - IN DEVELOPMENT
```{contents}
---
@ -153,6 +153,6 @@ When overriding the `get_form_class` method of a ModelAdmin `CreateView` or `Edi
### `StreamField`s must explicitly set `use_json_field` argument to `True`/`False`
`StreamField` now requires a `use_json_field` keyword argument that can be set to `True`/`False`. If set to `True`, the field will use `JSONField` as its internal type instead of `TextField`, which will change the data type used on the database and allow you to use `JSONField` lookups and transforms on the `StreamField`. If set to `False`, the field will keep its previous behaviour and no database changes will be made. If set to `None` (the default), the field will keep its previous behaviour and a warning (`RemovedInWagtail219Warning`) will appear.
`StreamField` now requires a `use_json_field` keyword argument that can be set to `True`/`False`. If set to `True`, the field will use `JSONField` as its internal type instead of `TextField`, which will change the data type used on the database and allow you to use `JSONField` lookups and transforms on the `StreamField`. If set to `False`, the field will keep its previous behaviour and no database changes will be made. If set to `None` (the default), the field will keep its previous behaviour and a warning (`RemovedInWagtail50Warning`) will appear.
After setting the keyword argument, make sure to generate and run the migrations for the models.

Wyświetl plik

@ -5,7 +5,7 @@ Release notes
:maxdepth: 1
upgrading
2.17
3.0
2.16.2
2.16.1
2.16

Wyświetl plik

@ -149,5 +149,5 @@ The compatible versions of Django and Python for each Wagtail release are:
+-------------------+------------------------------+-----------------------------+
| 2.16 | 3.2, 4.0 | 3.7, 3.8, 3.9, 3.10 |
+-------------------+------------------------------+-----------------------------+
| 2.17 | 3.2, 4.0 | 3.7, 3.8, 3.9, 3.10 |
| 3.0 | 3.2, 4.0 | 3.7, 3.8, 3.9, 3.10 |
+-------------------+------------------------------+-----------------------------+

Wyświetl plik

@ -132,7 +132,7 @@ These allow editing of model fields. The `FieldPanel` class will choose the corr
- {class}`~wagtail.admin.panels.FieldPanel`
- {class}`~wagtail.admin.panels.PageChooserPanel`
```{versionchanged} 2.17
```{versionchanged} 3.0
Previously, certain field types required special-purpose panels: `StreamFieldPanel`, `ImageChooserPanel`, `DocumentChooserPanel` and `SnippetChooserPanel`. These are now all handled by `FieldPanel`.
```

Wyświetl plik

@ -6,7 +6,7 @@ from wagtail.utils.version import get_semver_version, get_version
# major.minor.patch.release.number
# release must be one of alpha, beta, rc, or final
VERSION = (2, 17, 0, "alpha", 0)
VERSION = (3, 0, 0, "alpha", 0)
__version__ = get_version(VERSION)

Wyświetl plik

@ -25,7 +25,7 @@ from wagtail.blocks import BlockField
from wagtail.coreutils import camelcase_to_underscore
from wagtail.models import COMMENTS_RELATION_NAME, Page
from wagtail.utils.decorators import cached_classmethod
from wagtail.utils.deprecation import RemovedInWagtail219Warning
from wagtail.utils.deprecation import RemovedInWagtail50Warning
# DIRECT_FORM_FIELD_OVERRIDES, FORM_FIELD_OVERRIDES are imported for backwards
# compatibility, as people are likely importing them from here and then
@ -143,7 +143,7 @@ class Panel:
"The `widget_overrides` method (on %r) is deprecated; "
"these should be returned from `get_form_options` as a "
"`widgets` item instead." % type(self),
category=RemovedInWagtail219Warning,
category=RemovedInWagtail50Warning,
)
options["widgets"] = self.widget_overrides()
@ -152,7 +152,7 @@ class Panel:
"The `required_fields` method (on %r) is deprecated; "
"these should be returned from `get_form_options` as a "
"`fields` item instead." % type(self),
category=RemovedInWagtail219Warning,
category=RemovedInWagtail50Warning,
)
options["fields"] = self.required_fields()
@ -161,25 +161,25 @@ class Panel:
"The `required_formsets` method (on %r) is deprecated; "
"these should be returned from `get_form_options` as a "
"`formsets` item instead." % type(self),
category=RemovedInWagtail219Warning,
category=RemovedInWagtail50Warning,
)
options["formsets"] = self.required_formsets()
return options
# RemovedInWagtail219Warning - edit handlers should override get_form_options instead
# RemovedInWagtail50Warning - edit handlers should override get_form_options instead
def widget_overrides(self):
return {}
widget_overrides.is_original_method = True
# RemovedInWagtail219Warning - edit handlers should override get_form_options instead
# RemovedInWagtail50Warning - edit handlers should override get_form_options instead
def required_fields(self):
return []
required_fields.is_original_method = True
# RemovedInWagtail219Warning - edit handlers should override get_form_options instead
# RemovedInWagtail50Warning - edit handlers should override get_form_options instead
def required_formsets(self):
return {}
@ -311,7 +311,7 @@ class EditHandler(Panel):
def __init__(self, *args, **kwargs):
warn(
"wagtail.admin.edit_handlers.EditHandler has been renamed to wagtail.admin.panels.Panel",
category=RemovedInWagtail219Warning,
category=RemovedInWagtail50Warning,
stacklevel=2,
)
super().__init__(*args, **kwargs)
@ -430,7 +430,7 @@ class BaseCompositeEditHandler(PanelGroup):
def __init__(self, *args, **kwargs):
warn(
"wagtail.admin.edit_handlers.BaseCompositeEditHandler has been renamed to wagtail.admin.panels.PanelGroup",
category=RemovedInWagtail219Warning,
category=RemovedInWagtail50Warning,
stacklevel=2,
)
super().__init__(*args, **kwargs)
@ -731,7 +731,7 @@ class RichTextFieldPanel(FieldPanel):
def __init__(self, *args, **kwargs):
warn(
"wagtail.admin.edit_handlers.RichTextFieldPanel is obsolete and should be replaced by wagtail.admin.panels.FieldPanel",
category=RemovedInWagtail219Warning,
category=RemovedInWagtail50Warning,
stacklevel=2,
)
super().__init__(*args, **kwargs)
@ -741,7 +741,7 @@ class BaseChooserPanel(FieldPanel):
def __init__(self, *args, **kwargs):
warn(
"wagtail.admin.edit_handlers.BaseChooserPanel is obsolete and should be replaced by wagtail.admin.panels.FieldPanel",
category=RemovedInWagtail219Warning,
category=RemovedInWagtail50Warning,
stacklevel=2,
)
super().__init__(*args, **kwargs)
@ -1137,7 +1137,7 @@ class StreamFieldPanel(FieldPanel):
def __init__(self, *args, **kwargs):
warn(
"wagtail.admin.edit_handlers.StreamFieldPanel is obsolete and should be replaced by wagtail.admin.panels.FieldPanel",
category=RemovedInWagtail219Warning,
category=RemovedInWagtail50Warning,
stacklevel=2,
)
super().__init__(*args, **kwargs)

Wyświetl plik

@ -27,7 +27,7 @@
<div class="explorer__wrapper" data-explorer-menu></div>
</aside>
{# Backwards-compatibility for branding_logo customisations in legacy sidebar. #}
{# RemovedInWagtail218Warning Remove when removing the legacy sidebar. #}
{# RemovedInWagtail40Warning Remove when removing the legacy sidebar. #}
<script>
const branding_logo = document.querySelector('[data-wagtail-sidebar-branding-logo]');
const legacySidebar = document.querySelector('[data-nav-primary]');

Wyświetl plik

@ -1,14 +1,14 @@
from warnings import warn
from wagtail.admin.panels import FieldPanel
from wagtail.utils.deprecation import RemovedInWagtail219Warning
from wagtail.utils.deprecation import RemovedInWagtail50Warning
class DocumentChooserPanel(FieldPanel):
def __init__(self, *args, **kwargs):
warn(
"wagtail.documents.edit_handlers.DocumentChooserPanel is obsolete and should be replaced by wagtail.admin.panels.FieldPanel",
category=RemovedInWagtail219Warning,
category=RemovedInWagtail50Warning,
stacklevel=2,
)
super().__init__(*args, **kwargs)

Wyświetl plik

@ -8,7 +8,7 @@ from django.utils.encoding import force_str
from wagtail.blocks import Block, BlockField, StreamBlock, StreamValue
from wagtail.rich_text import get_text_for_indexing
from wagtail.utils.deprecation import RemovedInWagtail219Warning
from wagtail.utils.deprecation import RemovedInWagtail50Warning
class RichTextField(models.TextField):
@ -103,7 +103,7 @@ class StreamField(models.Field):
if type(self.use_json_field) is not bool:
warnings.warn(
f"StreamField must explicitly set use_json_field argument to True/False instead of {self.use_json_field}.",
RemovedInWagtail219Warning,
RemovedInWagtail50Warning,
stacklevel=3,
)

Wyświetl plik

@ -4,14 +4,14 @@ from django.template.loader import render_to_string
from wagtail.admin.compare import ForeignObjectComparison
from wagtail.admin.panels import FieldPanel
from wagtail.utils.deprecation import RemovedInWagtail219Warning
from wagtail.utils.deprecation import RemovedInWagtail50Warning
class ImageChooserPanel(FieldPanel):
def __init__(self, *args, **kwargs):
warn(
"wagtail.images.edit_handlers.ImageChooserPanel is obsolete and should be replaced by wagtail.admin.panels.FieldPanel",
category=RemovedInWagtail219Warning,
category=RemovedInWagtail50Warning,
stacklevel=2,
)
super().__init__(*args, **kwargs)

Wyświetl plik

@ -1,2 +1,2 @@
Django>=4.0,<4.1
wagtail==2.17a0
wagtail==3.0a0

Wyświetl plik

@ -1,14 +1,14 @@
from warnings import warn
from wagtail.admin.panels import FieldPanel
from wagtail.utils.deprecation import RemovedInWagtail219Warning
from wagtail.utils.deprecation import RemovedInWagtail50Warning
class SnippetChooserPanel(FieldPanel):
def __init__(self, *args, **kwargs):
warn(
"wagtail.snippets.edit_handlers.SnippetChooserPanel is obsolete and should be replaced by wagtail.admin.panels.FieldPanel",
category=RemovedInWagtail219Warning,
category=RemovedInWagtail50Warning,
stacklevel=2,
)
super().__init__(*args, **kwargs)

Wyświetl plik

@ -22,7 +22,7 @@ from wagtail.test.testapp.models import (
MinMaxCountStreamModel,
StreamModel,
)
from wagtail.utils.deprecation import RemovedInWagtail219Warning
from wagtail.utils.deprecation import RemovedInWagtail50Warning
class TestLazyStreamField(TestCase):
@ -644,7 +644,7 @@ class TestJSONStreamField(TestCase):
def test_use_json_field_warning(self):
message = "StreamField must explicitly set use_json_field argument to True/False instead of None."
with self.assertWarnsMessage(RemovedInWagtail219Warning, message):
with self.assertWarnsMessage(RemovedInWagtail50Warning, message):
StreamField([("paragraph", blocks.CharBlock())])
def test_internal_type(self):

Wyświetl plik

@ -2,14 +2,14 @@ import warnings
from importlib import import_module
class RemovedInWagtail218Warning(DeprecationWarning):
class RemovedInWagtail40Warning(DeprecationWarning):
pass
removed_in_next_version_warning = RemovedInWagtail218Warning
removed_in_next_version_warning = RemovedInWagtail40Warning
class RemovedInWagtail219Warning(PendingDeprecationWarning):
class RemovedInWagtail50Warning(PendingDeprecationWarning):
pass