Skip to content

Commit

Permalink
Move wagtail.admin.edit_handlers to wagtail.admin.panels
Browse files Browse the repository at this point in the history
  • Loading branch information
gasman committed Mar 25, 2022
1 parent 2a07990 commit b189ab8
Show file tree
Hide file tree
Showing 40 changed files with 1,149 additions and 1,153 deletions.
6 changes: 3 additions & 3 deletions docs/advanced_topics/customisation/page_editing_interface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ As standard, Wagtail organises panels for pages into three tabs: 'Content', 'Pro

.. code-block:: python
from wagtail.admin.edit_handlers import TabbedInterface, ObjectList
from wagtail.admin.panels import TabbedInterface, ObjectList
class BlogPage(Page):
# field definitions omitted
Expand Down Expand Up @@ -43,7 +43,7 @@ Wagtail provides a general-purpose WYSIWYG editor for creating rich text content
.. code-block:: python
from wagtail.fields import RichTextField
from wagtail.admin.edit_handlers import FieldPanel
from wagtail.admin.panels import FieldPanel
class BookPage(Page):
Expand Down Expand Up @@ -160,7 +160,7 @@ or to add custom validation logic for your models:
from django import forms
from django.db import models
import geocoder # not in Wagtail, for example only - https://geocoder.readthedocs.io/
from wagtail.admin.edit_handlers import FieldPanel
from wagtail.admin.panels import FieldPanel
from wagtail.admin.forms import WagtailAdminPageForm
from wagtail.models import Page
Expand Down
10 changes: 5 additions & 5 deletions docs/getting_started/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ from django.db import models

from wagtail.models import Page
from wagtail.fields import RichTextField
from wagtail.admin.edit_handlers import FieldPanel
from wagtail.admin.panels import FieldPanel


class HomePage(Page):
Expand Down Expand Up @@ -224,7 +224,7 @@ Lets start with a simple index page for our blog. In `blog/models.py`:
```python
from wagtail.models import Page
from wagtail.fields import RichTextField
from wagtail.admin.edit_handlers import FieldPanel
from wagtail.admin.panels import FieldPanel


class BlogIndexPage(Page):
Expand Down Expand Up @@ -278,7 +278,7 @@ from django.db import models

from wagtail.models import Page
from wagtail.fields import RichTextField
from wagtail.admin.edit_handlers import FieldPanel
from wagtail.admin.panels import FieldPanel
from wagtail.search import index


Expand Down Expand Up @@ -466,7 +466,7 @@ from modelcluster.fields import ParentalKey

from wagtail.models import Page, Orderable
from wagtail.fields import RichTextField
from wagtail.admin.edit_handlers import FieldPanel, InlinePanel
from wagtail.admin.panels import FieldPanel, InlinePanel
from wagtail.search import index


Expand Down Expand Up @@ -621,7 +621,7 @@ from taggit.models import TaggedItemBase

from wagtail.models import Page, Orderable
from wagtail.fields import RichTextField
from wagtail.admin.edit_handlers import FieldPanel, InlinePanel, MultiFieldPanel
from wagtail.admin.panels import FieldPanel, InlinePanel, MultiFieldPanel
from wagtail.search import index


Expand Down
14 changes: 7 additions & 7 deletions docs/reference/contrib/forms/customisation.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ You can do this as shown below.

```python
from modelcluster.fields import ParentalKey
from wagtail.admin.edit_handlers import (
from wagtail.admin.panels import (
FieldPanel, FieldRowPanel,
InlinePanel, MultiFieldPanel
)
Expand Down Expand Up @@ -61,7 +61,7 @@ from django.conf import settings
from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
from modelcluster.fields import ParentalKey
from wagtail.admin.edit_handlers import (
from wagtail.admin.panels import (
FieldPanel, FieldRowPanel,
InlinePanel, MultiFieldPanel
)
Expand Down Expand Up @@ -121,7 +121,7 @@ from django.conf import settings
from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
from modelcluster.fields import ParentalKey
from wagtail.admin.edit_handlers import (
from wagtail.admin.panels import (
FieldPanel, FieldRowPanel,
InlinePanel, MultiFieldPanel
)
Expand Down Expand Up @@ -195,7 +195,7 @@ from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
from django.shortcuts import render
from modelcluster.fields import ParentalKey
from wagtail.admin.edit_handlers import (
from wagtail.admin.panels import (
FieldPanel, FieldRowPanel,
InlinePanel, MultiFieldPanel
)
Expand Down Expand Up @@ -288,7 +288,7 @@ The following example shows how to create a multi-step form.
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from django.shortcuts import render
from modelcluster.fields import ParentalKey
from wagtail.admin.edit_handlers import (
from wagtail.admin.panels import (
FieldPanel, FieldRowPanel,
InlinePanel, MultiFieldPanel
)
Expand Down Expand Up @@ -430,7 +430,7 @@ First, you need to collect results as shown below:

```python
from modelcluster.fields import ParentalKey
from wagtail.admin.edit_handlers import (
from wagtail.admin.panels import (
FieldPanel, FieldRowPanel,
InlinePanel, MultiFieldPanel
)
Expand Down Expand Up @@ -544,7 +544,7 @@ Finally, we add a URL param of `id` based on the `form_submission` if it exists.

```python
from django.shortcuts import redirect
from wagtail.admin.edit_handlers import FieldPanel, FieldRowPanel, InlinePanel, MultiFieldPanel
from wagtail.admin.panels import FieldPanel, FieldRowPanel, InlinePanel, MultiFieldPanel
from wagtail.contrib.forms.models import AbstractEmailForm

class FormPage(AbstractEmailForm):
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/contrib/forms/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Within the `models.py` of one of your apps, create a model that extends `wagtail
```python
from django.db import models
from modelcluster.fields import ParentalKey
from wagtail.admin.edit_handlers import (
from wagtail.admin.panels import (
FieldPanel, FieldRowPanel,
InlinePanel, MultiFieldPanel
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ and ManyToManyField fields.
``ModelAdmin.get_edit_handler()``
-----------------------------------

**Must return**: An instance of ``wagtail.admin.edit_handlers.ObjectList``
**Must return**: An instance of ``wagtail.admin.panels.ObjectList``

Returns the appropriate ``edit_handler`` for the modeladmin class.
``edit_handlers`` can be defined either on the model itself or on the
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/contrib/modeladmin/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ to create, view, and edit ``Book`` entries.
.. code-block:: python
from django.db import models
from wagtail.admin.edit_handlers import FieldPanel
from wagtail.admin.panels import FieldPanel
class Book(models.Model):
title = models.CharField(max_length=255)
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/contrib/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ with a custom ``edit_handler`` attribute:

.. code-block:: python
from wagtail.admin.edit_handlers import TabbedInterface, ObjectList
from wagtail.admin.panels import TabbedInterface, ObjectList
@register_setting
class MySettings(BaseSetting):
Expand Down
12 changes: 6 additions & 6 deletions docs/reference/pages/panels.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Panel types
Built-in Fields and Choosers
----------------------------

Django's field types are automatically recognised and provided with an appropriate widget for input. Just define that field the normal Django way and pass the field name into :class:`~wagtail.admin.edit_handlers.FieldPanel` when defining your panels. Wagtail will take care of the rest.
Django's field types are automatically recognised and provided with an appropriate widget for input. Just define that field the normal Django way and pass the field name into :class:`~wagtail.admin.panels.FieldPanel` when defining your panels. Wagtail will take care of the rest.

Here are some Wagtail-specific types that you might include as fields in your models.

.. module:: wagtail.admin.edit_handlers
.. module:: wagtail.admin.panels

FieldPanel
~~~~~~~~~~
Expand Down Expand Up @@ -65,7 +65,7 @@ MultiFieldPanel

.. class:: MultiFieldPanel(children, heading="", classname=None)

This panel condenses several :class:`~wagtail.admin.edit_handlers.FieldPanel` s or choosers, from a ``list`` or ``tuple``, under a single ``heading`` string.
This panel condenses several :class:`~wagtail.admin.panels.FieldPanel` s or choosers, from a ``list`` or ``tuple``, under a single ``heading`` string.

.. attribute:: MultiFieldPanel.children

Expand Down Expand Up @@ -142,7 +142,7 @@ PageChooserPanel
.. code-block:: python
from wagtail.models import Page
from wagtail.admin.edit_handlers import PageChooserPanel
from wagtail.admin.panels import PageChooserPanel
class BookPage(Page):
Expand Down Expand Up @@ -242,7 +242,7 @@ By adding CSS classes to your panel definitions or adding extra parameters to yo
Full-Width Input
~~~~~~~~~~~~~~~~

Use ``classname="full"`` to make a field (input element) stretch the full width of the Wagtail page editor. This will not work if the field is encapsulated in a :class:`~wagtail.admin.edit_handlers.MultiFieldPanel`, which places its child fields into a formset.
Use ``classname="full"`` to make a field (input element) stretch the full width of the Wagtail page editor. This will not work if the field is encapsulated in a :class:`~wagtail.admin.panels.MultiFieldPanel`, which places its child fields into a formset.


Titles
Expand Down Expand Up @@ -366,7 +366,7 @@ Let's look at the example of adding related links to a :class:`~wagtail.models.P
InlinePanel('related_links', label="Related Links"),
]
The ``RelatedLink`` class is a vanilla Django abstract model. The ``BookPageRelatedLinks`` model extends it with capability for being ordered in the Wagtail interface via the ``Orderable`` class as well as adding a ``page`` property which links the model to the ``BookPage`` model we're adding the related links objects to. Finally, in the panel definitions for ``BookPage``, we'll add an :class:`~wagtail.admin.edit_handlers.InlinePanel` to provide an interface for it all. Let's look again at the parameters that :class:`~wagtail.admin.edit_handlers.InlinePanel` accepts:
The ``RelatedLink`` class is a vanilla Django abstract model. The ``BookPageRelatedLinks`` model extends it with capability for being ordered in the Wagtail interface via the ``Orderable`` class as well as adding a ``page`` property which links the model to the ``BookPage`` model we're adding the related links objects to. Finally, in the panel definitions for ``BookPage``, we'll add an :class:`~wagtail.admin.panels.InlinePanel` to provide an interface for it all. Let's look again at the parameters that :class:`~wagtail.admin.panels.InlinePanel` accepts:

.. code-block:: python
Expand Down
2 changes: 1 addition & 1 deletion docs/releases/2.17.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The panel types `StreamFieldPanel`, `RichTextFieldPanel`, `ImageChooserPanel`, `

### Permission-dependent FieldPanels

[`FieldPanel`](wagtail.admin.edit_handlers.FieldPanel) now accepts a `permission` keyword argument to specify that the field should only be available to users with a given permission level. This feature was developed by Matt Westcott and sponsored by Google as part of Wagtail's page editor redevelopment.
[`FieldPanel`](wagtail.admin.panels.FieldPanel) now accepts a `permission` keyword argument to specify that the field should only be available to users with a given permission level. This feature was developed by Matt Westcott and sponsored by Google as part of Wagtail's page editor redevelopment.


### Other features
Expand Down
14 changes: 7 additions & 7 deletions docs/topics/pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ from modelcluster.fields import ParentalKey

from wagtail.models import Page, Orderable
from wagtail.fields import RichTextField
from wagtail.admin.edit_handlers import FieldPanel, MultiFieldPanel, InlinePanel
from wagtail.admin.panels import FieldPanel, MultiFieldPanel, InlinePanel
from wagtail.search import index


Expand Down Expand Up @@ -129,8 +129,8 @@ Here's a summary of the `EditHandler` classes that Wagtail provides out of the b

These allow editing of model fields. The `FieldPanel` class will choose the correct widget based on the type of the field, such as a rich text editor for `RichTextField`, or an image chooser for a `ForeignKey` to an image model. `FieldPanel` also provides a page chooser interface for `ForeignKey`s to page models, but for more fine-grained control over which page types can be chosen, `PageChooserPanel` provides additional configuration options.

- {class}`~wagtail.admin.edit_handlers.FieldPanel`
- {class}`~wagtail.admin.edit_handlers.PageChooserPanel`
- {class}`~wagtail.admin.panels.FieldPanel`
- {class}`~wagtail.admin.panels.PageChooserPanel`

```{versionchanged} 2.17
Previously, certain field types required special-purpose panels: `StreamFieldPanel`, `ImageChooserPanel`, `DocumentChooserPanel` and `SnippetChooserPanel`. These are now all handled by `FieldPanel`.
Expand All @@ -140,9 +140,9 @@ Previously, certain field types required special-purpose panels: `StreamFieldPan

These are used for structuring fields in the interface.

- {class}`~wagtail.admin.edit_handlers.MultiFieldPanel`
- {class}`~wagtail.admin.edit_handlers.InlinePanel`
- {class}`~wagtail.admin.edit_handlers.FieldRowPanel`
- {class}`~wagtail.admin.panels.MultiFieldPanel`
- {class}`~wagtail.admin.panels.InlinePanel`
- {class}`~wagtail.admin.panels.FieldRowPanel`


#### Customising the page editor interface
Expand Down Expand Up @@ -356,7 +356,7 @@ class BlogPageRelatedLink(Orderable):
]
```

To add this to the admin interface, use the {class}`~wagtail.admin.edit_handlers.InlinePanel` edit panel class:
To add this to the admin interface, use the {class}`~wagtail.admin.panels.InlinePanel` edit panel class:

```python
content_panels = [
Expand Down
2 changes: 1 addition & 1 deletion docs/topics/snippets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Here's an example snippet model:
from django.db import models
from wagtail.admin.edit_handlers import FieldPanel
from wagtail.admin.panels import FieldPanel
from wagtail.snippets.models import register_snippet
...
Expand Down
2 changes: 1 addition & 1 deletion docs/topics/streamfield.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Using StreamField
from wagtail.models import Page
from wagtail.fields import StreamField
from wagtail import blocks
from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel
from wagtail.admin.panels import FieldPanel, StreamFieldPanel
from wagtail.images.blocks import ImageChooserBlock
class BlogPage(Page):
Expand Down
2 changes: 1 addition & 1 deletion wagtail/admin/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def inline_panel_model_panels_check(app_configs, **kwargs):

def check_panels_in_model(cls, context="model"):
"""Check panels configuration uses `panels` when `edit_handler` not in use."""
from wagtail.admin.edit_handlers import BaseCompositeEditHandler, InlinePanel
from wagtail.admin.panels import BaseCompositeEditHandler, InlinePanel
from wagtail.models import Page

errors = []
Expand Down
Loading

0 comments on commit b189ab8

Please sign in to comment.