mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-13 17:53:12 +00:00
Rename wagtail.wagtailcore to wagtail.core
This commit is contained in:
parent
026346b977
commit
4300e19da2
367 changed files with 498 additions and 498 deletions
|
|
@ -8,8 +8,8 @@ source_lang = en
|
|||
type = PO
|
||||
|
||||
[wagtail.wagtailcore]
|
||||
file_filter = wagtail/wagtailcore/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/wagtailcore/locale/en/LC_MESSAGES/django.po
|
||||
file_filter = wagtail/core/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/core/locale/en/LC_MESSAGES/django.po
|
||||
source_lang = en
|
||||
type = PO
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ You need to create a ``templates/wagtailadmin/`` folder within one of your apps
|
|||
|
||||
'dashboard',
|
||||
|
||||
'wagtail.wagtailcore',
|
||||
'wagtail.core',
|
||||
'wagtail.wagtailadmin',
|
||||
|
||||
# ...
|
||||
|
|
|
|||
|
|
@ -38,11 +38,11 @@ As standard, Wagtail organises panels for pages into three tabs: 'Content', 'Pro
|
|||
Rich Text (HTML)
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
Wagtail provides a general-purpose WYSIWYG editor for creating rich text content (HTML) and embedding media such as images, video, and documents. To include this in your models, use the :class:`~wagtail.wagtailcore.fields.RichTextField` function when defining a model field:
|
||||
Wagtail provides a general-purpose WYSIWYG editor for creating rich text content (HTML) and embedding media such as images, video, and documents. To include this in your models, use the :class:`~wagtail.core.fields.RichTextField` function when defining a model field:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.wagtailadmin.edit_handlers import FieldPanel
|
||||
|
||||
|
||||
|
|
@ -53,9 +53,9 @@ Wagtail provides a general-purpose WYSIWYG editor for creating rich text content
|
|||
FieldPanel('body', classname="full"),
|
||||
]
|
||||
|
||||
:class:`~wagtail.wagtailcore.fields.RichTextField` inherits from Django's basic ``TextField`` field, so you can pass any field parameters into :class:`~wagtail.wagtailcore.fields.RichTextField` as if using a normal Django field. This field does not need a special panel and can be defined with ``FieldPanel``.
|
||||
:class:`~wagtail.core.fields.RichTextField` inherits from Django's basic ``TextField`` field, so you can pass any field parameters into :class:`~wagtail.core.fields.RichTextField` as if using a normal Django field. This field does not need a special panel and can be defined with ``FieldPanel``.
|
||||
|
||||
However, template output from :class:`~wagtail.wagtailcore.fields.RichTextField` is special and need to be filtered to preserve embedded content. See :ref:`rich-text-filter`.
|
||||
However, template output from :class:`~wagtail.core.fields.RichTextField` is special and need to be filtered to preserve embedded content. See :ref:`rich-text-filter`.
|
||||
|
||||
|
||||
.. _rich_text_features:
|
||||
|
|
@ -97,7 +97,7 @@ Once the plugin has been created, it should be registered as a rich text feature
|
|||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailadmin.rich_text import HalloPlugin
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
@hooks.register('register_rich_text_features')
|
||||
def register_embed_feature(features):
|
||||
|
|
@ -141,7 +141,7 @@ To have a feature active by default (i.e. on ``RichTextFields`` that do not defi
|
|||
Image Formats in the Rich Text Editor
|
||||
-------------------------------------
|
||||
|
||||
On loading, Wagtail will search for any app with the file ``image_formats.py`` and execute the contents. This provides a way to customise the formatting options shown to the editor when inserting images in the :class:`~wagtail.wagtailcore.fields.RichTextField` editor.
|
||||
On loading, Wagtail will search for any app with the file ``image_formats.py`` and execute the contents. This provides a way to customise the formatting options shown to the editor when inserting images in the :class:`~wagtail.core.fields.RichTextField` editor.
|
||||
|
||||
As an example, add a "thumbnail" format:
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ To begin, import the ``Format`` class, ``register_image_format`` function, and o
|
|||
The unique key used to identify the format. To unregister this format, call ``unregister_image_format`` with this string as the only argument.
|
||||
|
||||
``label``
|
||||
The label used in the chooser form when inserting the image into the :class:`~wagtail.wagtailcore.fields.RichTextField`.
|
||||
The label used in the chooser form when inserting the image into the :class:`~wagtail.core.fields.RichTextField`.
|
||||
|
||||
``classnames``
|
||||
The string to assign to the ``class`` attribute of the generated ``<img>`` tag.
|
||||
|
|
@ -197,7 +197,7 @@ or to add custom validation logic for your models:
|
|||
import geocoder # not in Wagtail, for example only - http://geocoder.readthedocs.io/
|
||||
from wagtail.wagtailadmin.edit_handlers import FieldPanel
|
||||
from wagtail.wagtailadmin.forms import WagtailAdminPageForm
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.core.models import Page
|
||||
|
||||
|
||||
class EventPageForm(WagtailAdminPageForm):
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ We must set Django's ``LANGUAGES`` setting so we don't redirect non English/Fren
|
|||
from django.utils import translation
|
||||
from django.http import HttpResponseRedirect
|
||||
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.core.models import Page
|
||||
|
||||
|
||||
class LanguageRedirectionPage(Page):
|
||||
|
|
@ -58,7 +58,7 @@ Here's an example of how this could be implemented (with English as the main lan
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.wagtailadmin.edit_handlers import MultiFieldPanel, PageChooserPanel
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ This feature is enabled through the project's root URL configuration. Just put t
|
|||
|
||||
from wagtail.wagtailadmin import urls as wagtailadmin_urls
|
||||
from wagtail.wagtaildocs import urls as wagtaildocs_urls
|
||||
from wagtail.wagtailcore import urls as wagtail_urls
|
||||
from wagtail.core import urls as wagtail_urls
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Django needs to be configured to support Jinja2 templates. As the Wagtail admin
|
|||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'extensions': [
|
||||
'wagtail.wagtailcore.jinja2tags.core',
|
||||
'wagtail.core.jinja2tags.core',
|
||||
'wagtail.wagtailadmin.jinja2tags.userbar',
|
||||
'wagtail.wagtailimages.jinja2tags.images',
|
||||
],
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ Middleware (``settings.py``)
|
|||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
|
||||
'wagtail.wagtailcore.middleware.SiteMiddleware',
|
||||
'wagtail.core.middleware.SiteMiddleware',
|
||||
|
||||
'wagtail.wagtailredirects.middleware.RedirectMiddleware',
|
||||
]
|
||||
|
|
@ -70,7 +70,7 @@ Apps (``settings.py``)
|
|||
'wagtail.wagtailimages',
|
||||
'wagtail.wagtailsearch',
|
||||
'wagtail.wagtailadmin',
|
||||
'wagtail.wagtailcore',
|
||||
'wagtail.core',
|
||||
|
||||
'taggit',
|
||||
'modelcluster',
|
||||
|
|
@ -447,7 +447,7 @@ URL Patterns
|
|||
|
||||
from django.contrib import admin
|
||||
|
||||
from wagtail.wagtailcore import urls as wagtail_urls
|
||||
from wagtail.core import urls as wagtail_urls
|
||||
from wagtail.wagtailadmin import urls as wagtailadmin_urls
|
||||
from wagtail.wagtaildocs import urls as wagtaildocs_urls
|
||||
from wagtail.wagtailsearch import urls as wagtailsearch_urls
|
||||
|
|
@ -512,7 +512,7 @@ These two files should reside in your project directory (``myproject/myproject/`
|
|||
'wagtail.wagtailimages',
|
||||
'wagtail.wagtailsearch',
|
||||
'wagtail.wagtailadmin',
|
||||
'wagtail.wagtailcore',
|
||||
'wagtail.core',
|
||||
|
||||
'taggit',
|
||||
'modelcluster',
|
||||
|
|
@ -534,7 +534,7 @@ These two files should reside in your project directory (``myproject/myproject/`
|
|||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
|
||||
'wagtail.wagtailcore.middleware.SiteMiddleware',
|
||||
'wagtail.core.middleware.SiteMiddleware',
|
||||
'wagtail.wagtailredirects.middleware.RedirectMiddleware',
|
||||
]
|
||||
|
||||
|
|
@ -690,7 +690,7 @@ These two files should reside in your project directory (``myproject/myproject/`
|
|||
from django.conf import settings
|
||||
import os.path
|
||||
|
||||
from wagtail.wagtailcore import urls as wagtail_urls
|
||||
from wagtail.core import urls as wagtail_urls
|
||||
from wagtail.wagtailadmin import urls as wagtailadmin_urls
|
||||
from wagtail.wagtaildocs import urls as wagtaildocs_urls
|
||||
from wagtail.wagtailsearch import urls as wagtailsearch_urls
|
||||
|
|
|
|||
|
|
@ -72,14 +72,14 @@ an argument to ``runtests.py``:
|
|||
|
||||
.. code-block:: console
|
||||
|
||||
$ python runtests.py wagtail.wagtailcore
|
||||
$ python runtests.py wagtail.core
|
||||
|
||||
You can also run tests for individual TestCases by passing in the path as
|
||||
an argument to ``runtests.py``
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ python runtests.py wagtail.wagtailcore.tests.test_blocks.TestIntegerBlock
|
||||
$ python runtests.py wagtail.core.tests.test_blocks.TestIntegerBlock
|
||||
|
||||
**Running migrations for the test app models**
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ In your settings file, add the following apps to ``INSTALLED_APPS``:
|
|||
'wagtail.wagtailimages',
|
||||
'wagtail.wagtailsearch',
|
||||
'wagtail.wagtailadmin',
|
||||
'wagtail.wagtailcore',
|
||||
'wagtail.core',
|
||||
|
||||
'modelcluster',
|
||||
'taggit',
|
||||
|
|
@ -39,7 +39,7 @@ Add the following entries to ``MIDDLEWARE``:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
'wagtail.wagtailcore.middleware.SiteMiddleware',
|
||||
'wagtail.core.middleware.SiteMiddleware',
|
||||
'wagtail.wagtailredirects.middleware.RedirectMiddleware',
|
||||
|
||||
Add a ``STATIC_ROOT`` setting, if your project does not have one already:
|
||||
|
|
@ -65,7 +65,7 @@ Now make the following additions to your ``urls.py`` file:
|
|||
|
||||
from wagtail.wagtailadmin import urls as wagtailadmin_urls
|
||||
from wagtail.wagtaildocs import urls as wagtaildocs_urls
|
||||
from wagtail.wagtailcore import urls as wagtail_urls
|
||||
from wagtail.core import urls as wagtail_urls
|
||||
|
||||
urlpatterns = [
|
||||
...
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ Edit ``home/models.py`` as follows, to add a ``body`` field to the model:
|
|||
|
||||
from django.db import models
|
||||
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.wagtailadmin.edit_handlers import FieldPanel
|
||||
|
||||
|
||||
|
|
@ -164,8 +164,8 @@ Lets start with a simple index page for our blog. In ``blog/models.py``:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.wagtailadmin.edit_handlers import FieldPanel
|
||||
|
||||
|
||||
|
|
@ -218,8 +218,8 @@ Now we need a model and template for our blog posts. In ``blog/models.py``:
|
|||
|
||||
from django.db import models
|
||||
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.wagtailadmin.edit_handlers import FieldPanel
|
||||
from wagtail.wagtailsearch import index
|
||||
|
||||
|
|
@ -409,8 +409,8 @@ Add a new ``BlogPageGalleryImage`` model to ``models.py``:
|
|||
|
||||
from modelcluster.fields import ParentalKey
|
||||
|
||||
from wagtail.wagtailcore.models import Page, Orderable
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.core.models import Page, Orderable
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.wagtailadmin.edit_handlers import FieldPanel, InlinePanel
|
||||
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
|
||||
from wagtail.wagtailsearch import index
|
||||
|
|
@ -572,8 +572,8 @@ First, alter ``models.py`` once more:
|
|||
from modelcluster.contrib.taggit import ClusterTaggableManager
|
||||
from taggit.models import TaggedItemBase
|
||||
|
||||
from wagtail.wagtailcore.models import Page, Orderable
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.core.models import Page, Orderable
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.wagtailadmin.edit_handlers import FieldPanel, InlinePanel, MultiFieldPanel
|
||||
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
|
||||
from wagtail.wagtailsearch import index
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ You can do this as shown below.
|
|||
FieldPanel, FieldRowPanel,
|
||||
InlinePanel, MultiFieldPanel
|
||||
)
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormField
|
||||
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ Example:
|
|||
FieldPanel, FieldRowPanel,
|
||||
InlinePanel, MultiFieldPanel
|
||||
)
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormField, AbstractFormSubmission
|
||||
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ The following example shows how to add a username to the CSV export:
|
|||
FieldPanel, FieldRowPanel,
|
||||
InlinePanel, MultiFieldPanel
|
||||
)
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormField, AbstractFormSubmission
|
||||
|
||||
|
||||
|
|
@ -208,7 +208,7 @@ Example:
|
|||
FieldPanel, FieldRowPanel,
|
||||
InlinePanel, MultiFieldPanel
|
||||
)
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormField, AbstractFormSubmission
|
||||
|
||||
|
||||
|
|
@ -304,7 +304,7 @@ The following example shows how to create a multi-step form.
|
|||
FieldPanel, FieldRowPanel,
|
||||
InlinePanel, MultiFieldPanel
|
||||
)
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormField
|
||||
|
||||
|
||||
|
|
@ -455,7 +455,7 @@ First, you need to collect results as shown below:
|
|||
FieldPanel, FieldRowPanel,
|
||||
InlinePanel, MultiFieldPanel
|
||||
)
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormField
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ Within the ``models.py`` of one of your apps, create a model that extends ``wagt
|
|||
FieldPanel, FieldRowPanel,
|
||||
InlinePanel, MultiFieldPanel
|
||||
)
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormField
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ This signal handler would trigger the invalidation of the index page using the
|
|||
from django.dispatch import receiver
|
||||
from django.db.models.signals import pre_delete
|
||||
|
||||
from wagtail.wagtailcore.signals import page_published
|
||||
from wagtail.core.signals import page_published
|
||||
from wagtail.contrib.wagtailfrontendcache.utils import PurgeBatch
|
||||
|
||||
...
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ Add ``"wagtail.contrib.wagtailroutablepage"`` to your INSTALLED_APPS:
|
|||
The basics
|
||||
==========
|
||||
|
||||
To use ``RoutablePageMixin``, you need to make your class inherit from both :class:`wagtail.contrib.wagtailroutablepage.models.RoutablePageMixin` and :class:`wagtail.wagtailcore.models.Page`, then define some view methods and decorate them with ``wagtail.contrib.wagtailroutablepage.models.route``.
|
||||
To use ``RoutablePageMixin``, you need to make your class inherit from both :class:`wagtail.contrib.wagtailroutablepage.models.RoutablePageMixin` and :class:`wagtail.core.models.Page`, then define some view methods and decorate them with ``wagtail.contrib.wagtailroutablepage.models.route``.
|
||||
|
||||
Here's an example of an ``EventPage`` with three views:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.contrib.wagtailroutablepage.models import RoutablePageMixin, route
|
||||
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ Reversing URLs
|
|||
>>> event_page.reverse_subpage('events_for_year', args=(2015, ))
|
||||
'year/2015/'
|
||||
|
||||
This method only returns the part of the URL within the page. To get the full URL, you must append it to the values of either the :attr:`~wagtail.wagtailcore.models.Page.url` or the :attr:`~wagtail.wagtailcore.models.Page.full_url` attribute on your page:
|
||||
This method only returns the part of the URL within the page. To get the full URL, you must append it to the values of either the :attr:`~wagtail.core.models.Page.url` or the :attr:`~wagtail.core.models.Page.full_url` attribute on your page:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ The route name defaults to the name of the view. You can override this name with
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.contrib.wagtailroutablepage.models import RoutablePageMixin, route
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Registering functions with a Wagtail hook is done through the ``@hooks.register`
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
@hooks.register('name_of_hook')
|
||||
def my_hook_function(arg1, arg2...)
|
||||
|
|
@ -62,7 +62,7 @@ Hooks for building new areas of the admin interface (alongside pages, images, do
|
|||
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
class WelcomePanel(object):
|
||||
order = 50
|
||||
|
|
@ -96,7 +96,7 @@ Hooks for building new areas of the admin interface (alongside pages, images, do
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
@hooks.register('construct_main_menu')
|
||||
def hide_explorer_menu_item_from_frank(request, menu_items):
|
||||
|
|
@ -139,7 +139,7 @@ Hooks for building new areas of the admin interface (alongside pages, images, do
|
|||
|
||||
from django.urls import reverse
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
from wagtail.wagtailadmin.menu import MenuItem
|
||||
|
||||
@hooks.register('register_admin_menu_item')
|
||||
|
|
@ -161,7 +161,7 @@ Hooks for building new areas of the admin interface (alongside pages, images, do
|
|||
from django.http import HttpResponse
|
||||
from django.conf.urls import url
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
def admin_view(request):
|
||||
return HttpResponse(
|
||||
|
|
@ -215,7 +215,7 @@ Hooks for building new areas of the admin interface (alongside pages, images, do
|
|||
.. code-block:: python
|
||||
|
||||
from django.urls import reverse
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
from wagtail.wagtailadmin.search import SearchArea
|
||||
|
||||
@hooks.register('register_admin_search_area')
|
||||
|
|
@ -248,7 +248,7 @@ Hooks for building new areas of the admin interface (alongside pages, images, do
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
|
||||
@hooks.register('filter_form_submissions_for_user')
|
||||
|
|
@ -273,14 +273,14 @@ Hooks for customising the editing interface for pages and snippets.
|
|||
|
||||
Customise the rules that define which HTML elements are allowed in rich text areas. By default only a limited set of HTML elements and attributes are whitelisted - all others are stripped out. The callables passed into this hook must return a dict, which maps element names to handler functions that will perform some kind of manipulation of the element. These handler functions receive the element as a `BeautifulSoup <http://www.crummy.com/software/BeautifulSoup/bs4/doc/>`_ Tag object.
|
||||
|
||||
The ``wagtail.wagtailcore.whitelist`` module provides a few helper functions to assist in defining these handlers: ``allow_without_attributes``, a handler which preserves the element but strips out all of its attributes, and ``attribute_rule`` which accepts a dict specifying how to handle each attribute, and returns a handler function. This dict will map attribute names to either True (indicating that the attribute should be kept), False (indicating that it should be dropped), or a callable (which takes the initial attribute value and returns either a final value for the attribute, or None to drop the attribute).
|
||||
The ``wagtail.core.whitelist`` module provides a few helper functions to assist in defining these handlers: ``allow_without_attributes``, a handler which preserves the element but strips out all of its attributes, and ``attribute_rule`` which accepts a dict specifying how to handle each attribute, and returns a handler function. This dict will map attribute names to either True (indicating that the attribute should be kept), False (indicating that it should be dropped), or a callable (which takes the initial attribute value and returns either a final value for the attribute, or None to drop the attribute).
|
||||
|
||||
For example, the following hook function will add the ``<blockquote>`` element to the whitelist, and allow the ``target`` attribute on ``<a>`` elements:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.wagtailcore.whitelist import attribute_rule, check_url, allow_without_attributes
|
||||
from wagtail.core import hooks
|
||||
from wagtail.core.whitelist import attribute_rule, check_url, allow_without_attributes
|
||||
|
||||
@hooks.register('construct_whitelister_element_rules')
|
||||
def whitelister_element_rules():
|
||||
|
|
@ -302,7 +302,7 @@ Hooks for customising the editing interface for pages and snippets.
|
|||
from django.contrib.staticfiles.templatetags.staticfiles import static
|
||||
from django.utils.html import format_html
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
@hooks.register('insert_editor_css')
|
||||
def editor_css():
|
||||
|
|
@ -324,7 +324,7 @@ Hooks for customising the editing interface for pages and snippets.
|
|||
from django.utils.html import format_html
|
||||
from django.contrib.staticfiles.templatetags.staticfiles import static
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
@hooks.register('insert_global_admin_css')
|
||||
def global_admin_css():
|
||||
|
|
@ -343,7 +343,7 @@ Hooks for customising the editing interface for pages and snippets.
|
|||
from django.utils.html import format_html, format_html_join
|
||||
from django.conf import settings
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
@hooks.register('insert_editor_js')
|
||||
def editor_js():
|
||||
|
|
@ -375,7 +375,7 @@ Hooks for customising the editing interface for pages and snippets.
|
|||
|
||||
from django.utils.html import format_html
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
@hooks.register('insert_global_admin_js')
|
||||
def global_admin_js():
|
||||
|
|
@ -401,7 +401,7 @@ Hooks for customising the way users are directed through the process of creating
|
|||
|
||||
from django.http import HttpResponse
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
@hooks.register('after_create_page')
|
||||
def do_after_page_create(request, page):
|
||||
|
|
@ -423,7 +423,7 @@ Hooks for customising the way users are directed through the process of creating
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
from .models import AwesomePage
|
||||
from .admin_views import edit_awesome_page
|
||||
|
|
@ -501,7 +501,7 @@ Hooks for customising the way users are directed through the process of creating
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
class UserbarPuppyLinkItem(object):
|
||||
def render(self, request):
|
||||
|
|
@ -529,7 +529,7 @@ Hooks for customising the way admins are directed through the process of editing
|
|||
|
||||
from django.http import HttpResponse
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
@hooks.register('after_create_user')
|
||||
def do_after_page_create(request, user):
|
||||
|
|
@ -551,7 +551,7 @@ Hooks for customising the way admins are directed through the process of editing
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
from .models import AwesomePage
|
||||
from .admin_views import edit_awesome_page
|
||||
|
|
@ -609,7 +609,7 @@ Choosers
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
@hooks.register('construct_page_chooser_queryset')
|
||||
def show_my_pages_only(pages, request):
|
||||
|
|
@ -628,7 +628,7 @@ Choosers
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
@hooks.register('construct_document_chooser_queryset')
|
||||
def show_my_uploaded_documents_only(documents, request):
|
||||
|
|
@ -647,7 +647,7 @@ Choosers
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
@hooks.register('construct_image_chooser_queryset')
|
||||
def show_my_uploaded_images_only(images, request):
|
||||
|
|
@ -669,7 +669,7 @@ Page explorer
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
@hooks.register('construct_explorer_page_queryset')
|
||||
def show_my_profile_only(parent_page, pages, request):
|
||||
|
|
@ -777,7 +777,7 @@ Page serving
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
@hooks.register('before_serve_page')
|
||||
def block_googlebot(page, request, serve_args, serve_kwargs):
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Pages
|
||||
=====
|
||||
|
||||
Wagtail requires a little careful setup to define the types of content that you want to present through your website. The basic unit of content in Wagtail is the :class:`~wagtail.wagtailcore.models.Page`, and all of your page-level content will inherit basic webpage-related properties from it. But for the most part, you will be defining content yourself, through the construction of Django models using Wagtail's ``Page`` as a base.
|
||||
Wagtail requires a little careful setup to define the types of content that you want to present through your website. The basic unit of content in Wagtail is the :class:`~wagtail.core.models.Page`, and all of your page-level content will inherit basic webpage-related properties from it. But for the most part, you will be defining content yourself, through the construction of Django models using Wagtail's ``Page`` as a base.
|
||||
|
||||
Wagtail organizes content created from your models in a tree, which can have any structure and combination of model objects in it. Wagtail doesn't prescribe ways to organize and interrelate your content, but here we've sketched out some strategies for organizing your models.
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
Recipes
|
||||
=======
|
||||
|
||||
Overriding the :meth:`~wagtail.wagtailcore.models.Page.serve` Method
|
||||
Overriding the :meth:`~wagtail.core.models.Page.serve` Method
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Wagtail defaults to serving :class:`~wagtail.wagtailcore.models.Page`-derived models by passing a reference to the page object to a Django HTML template matching the model's name, but suppose you wanted to serve something other than HTML? You can override the :meth:`~wagtail.wagtailcore.models.Page.serve` method provided by the :class:`~wagtail.wagtailcore.models.Page` class and handle the Django request and response more directly.
|
||||
Wagtail defaults to serving :class:`~wagtail.core.models.Page`-derived models by passing a reference to the page object to a Django HTML template matching the model's name, but suppose you wanted to serve something other than HTML? You can override the :meth:`~wagtail.core.models.Page.serve` method provided by the :class:`~wagtail.core.models.Page` class and handle the Django request and response more directly.
|
||||
|
||||
Consider this example from the Wagtail demo site's ``models.py``, which serves an ``EventPage`` object as an iCal file if the ``format`` variable is set in the request:
|
||||
|
||||
|
|
@ -34,14 +34,14 @@ Consider this example from the Wagtail demo site's ``models.py``, which serves a
|
|||
# Display event page as usual
|
||||
return super(EventPage, self).serve(request)
|
||||
|
||||
:meth:`~wagtail.wagtailcore.models.Page.serve` takes a Django request object and returns a Django response object. Wagtail returns a ``TemplateResponse`` object with the template and context which it generates, which allows middleware to function as intended, so keep in mind that a simpler response object like a ``HttpResponse`` will not receive these benefits.
|
||||
:meth:`~wagtail.core.models.Page.serve` takes a Django request object and returns a Django response object. Wagtail returns a ``TemplateResponse`` object with the template and context which it generates, which allows middleware to function as intended, so keep in mind that a simpler response object like a ``HttpResponse`` will not receive these benefits.
|
||||
|
||||
With this strategy, you could use Django or Python utilities to render your model in JSON or XML or any other format you'd like.
|
||||
|
||||
|
||||
.. _overriding_route_method:
|
||||
|
||||
Adding Endpoints with Custom :meth:`~wagtail.wagtailcore.models.Page.route` Methods
|
||||
Adding Endpoints with Custom :meth:`~wagtail.core.models.Page.route` Methods
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
.. note::
|
||||
|
|
@ -80,20 +80,20 @@ Wagtail routes requests by iterating over the path components (separated with a
|
|||
# the page matches the request, but isn't published, so 404
|
||||
raise Http404
|
||||
|
||||
:meth:`~wagtail.wagtailcore.models.Page.route` takes the current object (``self``), the ``request`` object, and a list of the remaining ``path_components`` from the request URL. It either continues delegating routing by calling :meth:`~wagtail.wagtailcore.models.Page.route` again on one of its children in the Wagtail tree, or ends the routing process by returning a ``RouteResult`` object or raising a 404 error.
|
||||
:meth:`~wagtail.core.models.Page.route` takes the current object (``self``), the ``request`` object, and a list of the remaining ``path_components`` from the request URL. It either continues delegating routing by calling :meth:`~wagtail.core.models.Page.route` again on one of its children in the Wagtail tree, or ends the routing process by returning a ``RouteResult`` object or raising a 404 error.
|
||||
|
||||
The ``RouteResult`` object (defined in wagtail.wagtailcore.url_routing) encapsulates all the information Wagtail needs to call a page's :meth:`~wagtail.wagtailcore.models.Page.serve` method and return a final response: this information consists of the page object, and any additional ``args``/``kwargs`` to be passed to :meth:`~wagtail.wagtailcore.models.Page.serve`.
|
||||
The ``RouteResult`` object (defined in wagtail.core.url_routing) encapsulates all the information Wagtail needs to call a page's :meth:`~wagtail.core.models.Page.serve` method and return a final response: this information consists of the page object, and any additional ``args``/``kwargs`` to be passed to :meth:`~wagtail.core.models.Page.serve`.
|
||||
|
||||
By overriding the :meth:`~wagtail.wagtailcore.models.Page.route` method, we could create custom endpoints for each object in the Wagtail tree. One use case might be using an alternate template when encountering the ``print/`` endpoint in the path. Another might be a REST API which interacts with the current object. Just to see what's involved, lets make a simple model which prints out all of its child path components.
|
||||
By overriding the :meth:`~wagtail.core.models.Page.route` method, we could create custom endpoints for each object in the Wagtail tree. One use case might be using an alternate template when encountering the ``print/`` endpoint in the path. Another might be a REST API which interacts with the current object. Just to see what's involved, lets make a simple model which prints out all of its child path components.
|
||||
|
||||
First, ``models.py``:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from django.shortcuts import render
|
||||
from wagtail.wagtailcore.url_routing import RouteResult
|
||||
from wagtail.core.url_routing import RouteResult
|
||||
from django.http.response import Http404
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.core.models import Page
|
||||
|
||||
...
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Model Reference
|
||||
===============
|
||||
|
||||
.. automodule:: wagtail.wagtailcore.models
|
||||
.. automodule:: wagtail.core.models
|
||||
|
||||
This document contains reference information for the model classes inside the ``wagtailcore`` module.
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ Database fields
|
|||
|
||||
Defaults to ``False`` and can be overridden on the model with ``show_in_menus_default = True``.
|
||||
|
||||
This is used by the :meth:`~wagtail.wagtailcore.query.PageQuerySet.in_menu` QuerySet filter.
|
||||
This is used by the :meth:`~wagtail.core.query.PageQuerySet.in_menu` QuerySet filter.
|
||||
|
||||
Methods and properties
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
@ -220,7 +220,7 @@ In addition to the model fields provided, ``Page`` has many properties and metho
|
|||
|
||||
The ``Site`` model is useful for multi-site installations as it allows an administrator to configure which part of the tree to use for each hostname that the server responds on.
|
||||
|
||||
This configuration is used by the :class:`~wagtail.wagtailcore.middleware.SiteMiddleware` middleware class which checks each request against this configuration and appends the Site object to the Django request object.
|
||||
This configuration is used by the :class:`~wagtail.core.middleware.SiteMiddleware` middleware class which checks each request against this configuration and appends the Site object to the Django request object.
|
||||
|
||||
Database fields
|
||||
~~~~~~~~~~~~~~~
|
||||
|
|
@ -255,7 +255,7 @@ Database fields
|
|||
|
||||
.. attribute:: root_page
|
||||
|
||||
(foreign key to :class:`~wagtail.wagtailcore.models.Page`)
|
||||
(foreign key to :class:`~wagtail.core.models.Page`)
|
||||
|
||||
This is a link to the root page of the site. This page will be what appears at the ``/`` URL on the site and would usually be a homepage.
|
||||
|
||||
|
|
@ -293,9 +293,9 @@ Methods and properties
|
|||
|
||||
Every time a page is edited a new ``PageRevision`` is created and saved to the database. It can be used to find the full history of all changes that have been made to a page and it also provides a place for new changes to be kept before going live.
|
||||
|
||||
- Revisions can be created from any :class:`~wagtail.wagtailcore.models.Page` object by calling its :meth:`~Page.save_revision` method
|
||||
- Revisions can be created from any :class:`~wagtail.core.models.Page` object by calling its :meth:`~Page.save_revision` method
|
||||
- The content of the page is JSON-serialised and stored in the :attr:`~PageRevision.content_json` field
|
||||
- You can retrieve a ``PageRevision`` as a :class:`~wagtail.wagtailcore.models.Page` object by calling the :meth:`~PageRevision.as_page_object` method
|
||||
- You can retrieve a ``PageRevision`` as a :class:`~wagtail.core.models.Page` object by calling the :meth:`~PageRevision.as_page_object` method
|
||||
|
||||
Database fields
|
||||
~~~~~~~~~~~~~~~
|
||||
|
|
@ -304,7 +304,7 @@ Database fields
|
|||
|
||||
.. attribute:: page
|
||||
|
||||
(foreign key to :class:`~wagtail.wagtailcore.models.Page`)
|
||||
(foreign key to :class:`~wagtail.core.models.Page`)
|
||||
|
||||
.. attribute:: submitted_for_moderation
|
||||
|
||||
|
|
@ -362,7 +362,7 @@ Methods and properties
|
|||
|
||||
.. automethod:: as_page_object
|
||||
|
||||
This method retrieves this revision as an instance of its :class:`~wagtail.wagtailcore.models.Page` subclass.
|
||||
This method retrieves this revision as an instance of its :class:`~wagtail.core.models.Page` subclass.
|
||||
|
||||
.. automethod:: approve_moderation
|
||||
|
||||
|
|
@ -394,7 +394,7 @@ Database fields
|
|||
|
||||
.. attribute:: page
|
||||
|
||||
(foreign key to :class:`~wagtail.wagtailcore.models.Page`)
|
||||
(foreign key to :class:`~wagtail.core.models.Page`)
|
||||
|
||||
.. attribute:: permission_type
|
||||
|
||||
|
|
@ -410,7 +410,7 @@ Database fields
|
|||
|
||||
.. attribute:: page
|
||||
|
||||
(foreign key to :class:`~wagtail.wagtailcore.models.Page`)
|
||||
(foreign key to :class:`~wagtail.core.models.Page`)
|
||||
|
||||
.. attribute:: password
|
||||
|
||||
|
|
|
|||
|
|
@ -96,11 +96,11 @@ PageChooserPanel
|
|||
|
||||
.. class:: PageChooserPanel(field_name, page_type=None, can_choose_root=False)
|
||||
|
||||
You can explicitly link :class:`~wagtail.wagtailcore.models.Page`-derived models together using the :class:`~wagtail.wagtailcore.models.Page` model and ``PageChooserPanel``.
|
||||
You can explicitly link :class:`~wagtail.core.models.Page`-derived models together using the :class:`~wagtail.core.models.Page` model and ``PageChooserPanel``.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.wagtailadmin.edit_handlers import PageChooserPanel
|
||||
|
||||
|
||||
|
|
@ -294,11 +294,11 @@ Inline Panels and Model Clusters
|
|||
|
||||
The ``django-modelcluster`` module allows for streamlined relation of extra models to a Wagtail page. For instance, you can create objects related through a ``ForeignKey`` relationship on the fly and save them to a draft revision of a ``Page`` object. Normally, your related objects "cluster" would need to be created beforehand (or asynchronously) before linking them to a Page.
|
||||
|
||||
Let's look at the example of adding related links to a :class:`~wagtail.wagtailcore.models.Page`-derived model. We want to be able to add as many as we like, assign an order, and do all of this without leaving the page editing screen.
|
||||
Let's look at the example of adding related links to a :class:`~wagtail.core.models.Page`-derived model. We want to be able to add as many as we like, assign an order, and do all of this without leaving the page editing screen.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore.models import Orderable, Page
|
||||
from wagtail.core.models import Orderable, Page
|
||||
from modelcluster.fields import ParentalKey
|
||||
|
||||
# The abstract model for related links, complete with panels
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Page QuerySet reference
|
||||
=======================
|
||||
|
||||
All models that inherit from :class:`~wagtail.wagtailcore.models.Page` are given some extra QuerySet methods accessible from their ``.objects`` attribute.
|
||||
All models that inherit from :class:`~wagtail.core.models.Page` are given some extra QuerySet methods accessible from their ``.objects`` attribute.
|
||||
|
||||
|
||||
Examples
|
||||
|
|
@ -31,7 +31,7 @@ Examples
|
|||
Reference
|
||||
=========
|
||||
|
||||
.. automodule:: wagtail.wagtailcore.query
|
||||
.. automodule:: wagtail.core.query
|
||||
.. autoclass:: PageQuerySet
|
||||
|
||||
.. automethod:: live
|
||||
|
|
@ -248,6 +248,6 @@ Reference
|
|||
# in a minimum number of database queries.
|
||||
homepage.get_children().specific()
|
||||
|
||||
See also: :py:attr:`Page.specific <wagtail.wagtailcore.models.Page.specific>`
|
||||
See also: :py:attr:`Page.specific <wagtail.core.models.Page.specific>`
|
||||
|
||||
.. automethod:: first_common_ancestor
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ example showing how you might notify your team when something is published:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore.signals import page_published
|
||||
from wagtail.core.signals import page_published
|
||||
import urllib
|
||||
import urllib2
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ wish to do something when a new blog post is published:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore.signals import page_published
|
||||
from wagtail.core.signals import page_published
|
||||
from mysite.models import BlogPostPage
|
||||
|
||||
# Do something clever for each model type
|
||||
|
|
@ -69,7 +69,7 @@ wish to do something when a new blog post is published:
|
|||
# Register listeners for each page model class
|
||||
page_published.connect(receiver, sender=BlogPostPage)
|
||||
|
||||
Wagtail provides access to a list of registered page types through the ``get_page_models()`` function in ``wagtail.wagtailcore.models``.
|
||||
Wagtail provides access to a list of registered page types through the ``get_page_models()`` function in ``wagtail.core.models``.
|
||||
|
||||
Read the `Django documentation <https://docs.djangoproject.com/en/1.8/topics/signals/#connecting-to-specific-signals>`__ for more information about specifying senders.
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ Search on QuerySet with Elasticsearch
|
|||
|
||||
It's now possible to perform searches with Elasticsearch on ``PageQuerySet`` objects:
|
||||
|
||||
>>> from wagtail.wagtailcore.models import Page
|
||||
>>> from wagtail.core.models import Page
|
||||
>>> Page.objects.live().descendant_of(events_index).search("Hello")
|
||||
[<Page: Event 1>, <Page: Event 2>]
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ Wagtailadmins ``hooks`` module has moved to wagtailcore
|
|||
|
||||
If you use any ``wagtail_hooks.py`` files in your project, you may have an import like: ``from wagtail.wagtailadmin import hooks``
|
||||
|
||||
Change this to: ``from wagtail.wagtailcore import hooks``
|
||||
Change this to: ``from wagtail.core import hooks``
|
||||
|
||||
|
||||
Miscellaneous
|
||||
|
|
|
|||
|
|
@ -119,8 +119,8 @@ to:
|
|||
|
||||
and passing those through at the point where you are calling ``get_url_parts`` on ``super`` (if applicable).
|
||||
|
||||
See also: :meth:`wagtail.wagtailcore.models.Page.get_url_parts`, :meth:`wagtail.wagtailcore.models.Page.get_url`,
|
||||
:meth:`wagtail.wagtailcore.models.Page.get_full_url`, and :meth:`wagtail.wagtailcore.models.Page.relative_url`
|
||||
See also: :meth:`wagtail.core.models.Page.get_url_parts`, :meth:`wagtail.core.models.Page.get_url`,
|
||||
:meth:`wagtail.core.models.Page.get_full_url`, and :meth:`wagtail.core.models.Page.relative_url`
|
||||
|
||||
|
||||
"Password required" template for documents
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ Bug fixes
|
|||
* Dropdown for ``ForeignKey`` s are now styled consistently (Ashia Zawaduk)
|
||||
* Date choosers now appear on top of StreamField menus (Sergey Nikitin)
|
||||
* Fixed a migration error that was raised when block-updating from 0.8 to 1.1+
|
||||
* :meth:`Page.copy() <wagtail.wagtailcore.models.Page.copy>` no longer breaks on models with a ``ClusterTaggableManager`` or ``ManyToManyField``
|
||||
* :meth:`Page.copy() <wagtail.core.models.Page.copy>` no longer breaks on models with a ``ClusterTaggableManager`` or ``ManyToManyField``
|
||||
* Validation errors when inserting an embed into a rich text area are now reported back to the editor
|
||||
|
||||
Upgrade considerations
|
||||
|
|
@ -182,7 +182,7 @@ Wagtail API requires adding ``rest_framework`` to INSTALLED_APPS
|
|||
If you have the Wagtail API (``wagtail.contrib.wagtailapi``) enabled, you must now add ``'rest_framework'`` to your project's ``INSTALLED_APPS`` setting. In the current version the API will continue to function without this app, but the browsable front-end will not be available; this ability will be dropped in a future release.
|
||||
|
||||
|
||||
:meth:`Page.get_latest_revision_as_page() <wagtail.wagtailcore.models.Page.get_latest_revision_as_page>` now returns live page object when there are no draft changes
|
||||
:meth:`Page.get_latest_revision_as_page() <wagtail.core.models.Page.get_latest_revision_as_page>` now returns live page object when there are no draft changes
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If you have any application code that makes direct updates to page data, at the model or database level, be aware that the way these edits are reflected in the page editor has changed.
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ Due to a change in the way template tags are imported in Django 1.9, it has been
|
|||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'extensions': [
|
||||
'wagtail.wagtailcore.jinja2tags.core',
|
||||
'wagtail.core.jinja2tags.core',
|
||||
'wagtail.wagtailadmin.jinja2tags.userbar',
|
||||
'wagtail.wagtailimages.jinja2tags.images',
|
||||
],
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ Bug fixes
|
|||
~~~~~~~~~
|
||||
|
||||
* Wagtail's middleware classes are now compatible with Django 1.10's `new-style middleware <https://docs.djangoproject.com/en/1.10/releases/1.10/#new-style-middleware>`_ (Karl Hobley)
|
||||
* The :meth:`~wagtail.wagtailcore.models.Page.can_create_at` method is now checked in the create page view (Mikalai Radchuk)
|
||||
* The :meth:`~wagtail.core.models.Page.can_create_at` method is now checked in the create page view (Mikalai Radchuk)
|
||||
* Fixed regression on Django 1.10.1 causing Page subclasses to fail to use PageManager (Matt Westcott)
|
||||
* ChoiceBlocks with lazy translations as option labels no longer break Elasticsearch indexing (Matt Westcott)
|
||||
* The page editor no longer fails to load JavaScript files with ``ManifestStaticFilesStorage`` (Matt Westcott)
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ Other features
|
|||
* ``ChoiceBlock`` now accepts a callable as the choices list (Mikalai Radchuk)
|
||||
* Redundant action buttons are now omitted from the root page in the explorer (Nick Smith)
|
||||
* Locked pages are now disabled from editing at the browser level (Edd Baldry)
|
||||
* Added :meth:`wagtail.wagtailcore.query.PageQuerySet.in_site` method for filtering page querysets to pages within the specified site (Chris Rogers)
|
||||
* Added :meth:`wagtail.core.query.PageQuerySet.in_site` method for filtering page querysets to pages within the specified site (Chris Rogers)
|
||||
* Added the ability to override the default index settings for Elasticsearch. See :ref:`wagtailsearch_backends_elasticsearch` (PyMan Claudio Marinozzi)
|
||||
* Extra options for the Elasticsearch constructor should be now defined with the new key ``OPTIONS`` of the ``WAGTAILSEARCH_BACKENDS`` setting (PyMan Claudio Marinozzi)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
Page models
|
||||
===========
|
||||
|
||||
Each page type (a.k.a. content type) in Wagtail is represented by a Django model. All page models must inherit from the :class:`wagtail.wagtailcore.models.Page` class.
|
||||
Each page type (a.k.a. content type) in Wagtail is represented by a Django model. All page models must inherit from the :class:`wagtail.core.models.Page` class.
|
||||
|
||||
As all page types are Django models, you can use any field type that Django provides. See `Model field reference <https://docs.djangoproject.com/en/1.9/ref/models/fields/>`_ for a complete list of field types you can use. Wagtail also provides :class:`~wagtail.wagtailcore.fields.RichTextField` which provides a WYSIWYG editor for editing rich-text content.
|
||||
As all page types are Django models, you can use any field type that Django provides. See `Model field reference <https://docs.djangoproject.com/en/1.9/ref/models/fields/>`_ for a complete list of field types you can use. Wagtail also provides :class:`~wagtail.core.fields.RichTextField` which provides a WYSIWYG editor for editing rich-text content.
|
||||
|
||||
|
||||
.. topic:: Django models
|
||||
|
|
@ -26,8 +26,8 @@ This example represents a typical blog post:
|
|||
|
||||
from modelcluster.fields import ParentalKey
|
||||
|
||||
from wagtail.wagtailcore.models import Page, Orderable
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.core.models import Page, Orderable
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.wagtailadmin.edit_handlers import FieldPanel, MultiFieldPanel, InlinePanel
|
||||
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
|
||||
from wagtail.wagtailsearch import index
|
||||
|
|
@ -221,7 +221,7 @@ and pass those through at the point where you are calling ``get_url_parts`` on `
|
|||
While you could pass only the ``request`` keyword argument, passing all arguments as-is ensures compatibility with any
|
||||
future changes to these method signatures.
|
||||
|
||||
For more information, please see :meth:`wagtail.wagtailcore.models.Page.get_url_parts`.
|
||||
For more information, please see :meth:`wagtail.core.models.Page.get_url_parts`.
|
||||
|
||||
Obtaining URLs for page instances
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
@ -232,9 +232,9 @@ A common use case for ``get_url(request)`` is in any custom template tag your pr
|
|||
custom template tag, ensure it includes ``takes_context=True`` and use ``context.get('request')`` to safely pass the
|
||||
request or ``None`` if no request exists in the context.
|
||||
|
||||
For more information, please see :meth:`wagtail.wagtailcore.models.Page.get_url`.
|
||||
For more information, please see :meth:`wagtail.core.models.Page.get_url`.
|
||||
|
||||
In the event a full URL (including the protocol and domain) is needed, ``Page.get_full_url(request)`` can be used instead. Whenever possible, the optional ``request`` argument should be included to enable per-request caching of site-level URL information. For more information, please see :meth:`wagtail.wagtailcore.models.Page.get_full_url`.
|
||||
In the event a full URL (including the protocol and domain) is needed, ``Page.get_full_url(request)`` can be used instead. Whenever possible, the optional ``request`` argument should be included to enable per-request caching of site-level URL information. For more information, please see :meth:`wagtail.core.models.Page.get_full_url`.
|
||||
|
||||
Template rendering
|
||||
==================
|
||||
|
|
@ -360,7 +360,7 @@ Wagtail can nest the content of other models within the page. This is useful for
|
|||
|
||||
Each inline model requires the following:
|
||||
|
||||
- It must inherit from :class:`wagtail.wagtailcore.models.Orderable`
|
||||
- It must inherit from :class:`wagtail.core.models.Orderable`
|
||||
- It must have a ``ParentalKey`` to the parent model
|
||||
|
||||
.. note:: django-modelcluster and ParentalKey
|
||||
|
|
@ -380,7 +380,7 @@ For example, the following inline model can be used to add related links (a list
|
|||
|
||||
from django.db import models
|
||||
from modelcluster.fields import ParentalKey
|
||||
from wagtail.wagtailcore.models import Orderable
|
||||
from wagtail.core.models import Orderable
|
||||
|
||||
|
||||
class BlogPageRelatedLink(Orderable):
|
||||
|
|
@ -411,16 +411,16 @@ Working with pages
|
|||
|
||||
Wagtail uses Django's `multi-table inheritance <https://docs.djangoproject.com/en/1.8/topics/db/models/#multi-table-inheritance>`_ feature to allow multiple page models to be used in the same tree.
|
||||
|
||||
Each page is added to both Wagtail's builtin :class:`~wagtail.wagtailcore.models.Page` model as well as its user-defined model (such as the ``BlogPage`` model created earlier).
|
||||
Each page is added to both Wagtail's builtin :class:`~wagtail.core.models.Page` model as well as its user-defined model (such as the ``BlogPage`` model created earlier).
|
||||
|
||||
Pages can exist in Python code in two forms, an instance of ``Page`` or an instance of the page model.
|
||||
|
||||
When working with multiple page types together, you will typically use instances of Wagtail's :class:`~wagtail.wagtailcore.models.Page` model, which don't give you access to any fields specific to their type.
|
||||
When working with multiple page types together, you will typically use instances of Wagtail's :class:`~wagtail.core.models.Page` model, which don't give you access to any fields specific to their type.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# Get all pages in the database
|
||||
>>> from wagtail.wagtailcore.models import Page
|
||||
>>> from wagtail.core.models import Page
|
||||
>>> Page.objects.all()
|
||||
[<Page: Homepage>, <Page: About us>, <Page: Blog>, <Page: A Blog post>, <Page: Another Blog post>]
|
||||
|
||||
|
|
@ -490,12 +490,12 @@ This is because ``Page`` enforces ordering QuerySets by path. Instead, you must
|
|||
Custom Page managers
|
||||
--------------------
|
||||
|
||||
You can add a custom ``Manager`` to your ``Page`` class. Any custom Managers should inherit from :class:`wagtail.wagtailcore.models.PageManager`:
|
||||
You can add a custom ``Manager`` to your ``Page`` class. Any custom Managers should inherit from :class:`wagtail.core.models.PageManager`:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from django.db import models
|
||||
from wagtail.wagtailcore.models import Page, PageManager
|
||||
from wagtail.core.models import Page, PageManager
|
||||
|
||||
class EventPageManager(PageManager):
|
||||
""" Custom manager for Event pages """
|
||||
|
|
@ -505,13 +505,13 @@ You can add a custom ``Manager`` to your ``Page`` class. Any custom Managers sho
|
|||
|
||||
objects = EventPageManager()
|
||||
|
||||
Alternately, if you only need to add extra ``QuerySet`` methods, you can inherit from :class:`wagtail.wagtailcore.models.PageQuerySet`, and call :func:`~django.db.models.managers.Manager.from_queryset` to build a custom ``Manager``:
|
||||
Alternately, if you only need to add extra ``QuerySet`` methods, you can inherit from :class:`wagtail.core.models.PageQuerySet`, and call :func:`~django.db.models.managers.Manager.from_queryset` to build a custom ``Manager``:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
from wagtail.wagtailcore.models import Page, PageManager, PageQuerySet
|
||||
from wagtail.core.models import Page, PageManager, PageQuerySet
|
||||
|
||||
class EventPageQuerySet(PageQuerySet):
|
||||
def future(self):
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ Wagtail provides a shortcut for searching pages: the ``.search()`` ``QuerySet``
|
|||
.. code-block:: python
|
||||
|
||||
# Search future EventPages
|
||||
>>> from wagtail.wagtailcore.models import EventPage
|
||||
>>> from wagtail.core.models import EventPage
|
||||
>>> EventPage.objects.filter(date__gt=timezone.now()).search("Hello world!")
|
||||
|
||||
|
||||
|
|
@ -206,7 +206,7 @@ Here's an example Django view that could be used to add a "search" page to your
|
|||
|
||||
from django.shortcuts import render
|
||||
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.wagtailsearch.models import Query
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ To attach multiple adverts to a page, the ``SnippetChooserPanel`` can be placed
|
|||
|
||||
from django.db import models
|
||||
|
||||
from wagtail.wagtailcore.models import Page, Orderable
|
||||
from wagtail.core.models import Page, Orderable
|
||||
from wagtail.wagtailsnippets.edit_handlers import SnippetChooserPanel
|
||||
|
||||
from modelcluster.fields import ParentalKey
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ Using StreamField
|
|||
|
||||
from django.db import models
|
||||
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.wagtailcore.fields import StreamField
|
||||
from wagtail.wagtailcore import blocks
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.core.fields import StreamField
|
||||
from wagtail.core import blocks
|
||||
from wagtail.wagtailadmin.edit_handlers import FieldPanel, StreamFieldPanel
|
||||
from wagtail.wagtailimages.blocks import ImageChooserBlock
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ The basic block types provided by Wagtail are as follows:
|
|||
CharBlock
|
||||
~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.CharBlock``
|
||||
``wagtail.core.blocks.CharBlock``
|
||||
|
||||
A single-line text input. The following keyword arguments are accepted:
|
||||
|
||||
|
|
@ -90,14 +90,14 @@ A single-line text input. The following keyword arguments are accepted:
|
|||
TextBlock
|
||||
~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.TextBlock``
|
||||
``wagtail.core.blocks.TextBlock``
|
||||
|
||||
A multi-line text input. As with ``CharBlock``, the keyword arguments ``required`` (default: True), ``max_length``, ``min_length`` and ``help_text`` are accepted.
|
||||
|
||||
EmailBlock
|
||||
~~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.EmailBlock``
|
||||
``wagtail.core.blocks.EmailBlock``
|
||||
|
||||
A single-line email input that validates that the email is a valid Email Address. The keyword arguments ``required`` (default: True) and ``help_text`` are accepted.
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ For an example of ``EmailBlock`` in use, see :ref:`streamfield_personblock_examp
|
|||
IntegerBlock
|
||||
~~~~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.IntegerBlock``
|
||||
``wagtail.core.blocks.IntegerBlock``
|
||||
|
||||
A single-line integer input that validates that the integer is a valid whole number. The keyword arguments ``required`` (default: True), ``max_value``, ``min_value`` and ``help_text`` are accepted.
|
||||
|
||||
|
|
@ -115,14 +115,14 @@ For an example of ``IntegerBlock`` in use, see :ref:`streamfield_personblock_exa
|
|||
FloatBlock
|
||||
~~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.FloatBlock``
|
||||
``wagtail.core.blocks.FloatBlock``
|
||||
|
||||
A single-line Float input that validates that the value is a valid floating point number. The keyword arguments ``required`` (default: True), ``max_value`` and ``min_value`` are accepted.
|
||||
|
||||
DecimalBlock
|
||||
~~~~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.DecimalBlock``
|
||||
``wagtail.core.blocks.DecimalBlock``
|
||||
|
||||
A single-line decimal input that validates that the value is a valid decimal number. The keyword arguments ``required`` (default: True), ``help_text``, ``max_value``, ``min_value``, ``max_digits`` and ``decimal_places`` are accepted.
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ For an example of ``DecimalBlock`` in use, see :ref:`streamfield_personblock_exa
|
|||
RegexBlock
|
||||
~~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.RegexBlock``
|
||||
``wagtail.core.blocks.RegexBlock``
|
||||
|
||||
A single-line text input that validates a string against a regex expression. The regular expression used for validation must be supplied as the first argument, or as the keyword argument ``regex``. To customise the message text used to indicate a validation error, pass a dictionary as the keyword argument ``error_messages`` containing either or both of the keys ``required`` (for the message shown on an empty value) or ``invalid`` (for the message shown on a non-matching value):
|
||||
|
||||
|
|
@ -146,21 +146,21 @@ The keyword arguments ``regex``, ``help_text``, ``required`` (default: True), ``
|
|||
URLBlock
|
||||
~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.URLBlock``
|
||||
``wagtail.core.blocks.URLBlock``
|
||||
|
||||
A single-line text input that validates that the string is a valid URL. The keyword arguments ``required`` (default: True), ``max_length``, ``min_length`` and ``help_text`` are accepted.
|
||||
|
||||
BooleanBlock
|
||||
~~~~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.BooleanBlock``
|
||||
``wagtail.core.blocks.BooleanBlock``
|
||||
|
||||
A checkbox. The keyword arguments ``required`` and ``help_text`` are accepted. As with Django's ``BooleanField``, a value of ``required=True`` (the default) indicates that the checkbox must be ticked in order to proceed. For a checkbox that can be ticked or unticked, you must explicitly pass in ``required=False``.
|
||||
|
||||
DateBlock
|
||||
~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.DateBlock``
|
||||
``wagtail.core.blocks.DateBlock``
|
||||
|
||||
A date picker. The keyword arguments ``required`` (default: True), ``help_text`` and ``format`` are accepted.
|
||||
|
||||
|
|
@ -170,14 +170,14 @@ A date picker. The keyword arguments ``required`` (default: True), ``help_text``
|
|||
TimeBlock
|
||||
~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.TimeBlock``
|
||||
``wagtail.core.blocks.TimeBlock``
|
||||
|
||||
A time picker. The keyword arguments ``required`` (default: True) and ``help_text`` are accepted.
|
||||
|
||||
DateTimeBlock
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.DateTimeBlock``
|
||||
``wagtail.core.blocks.DateTimeBlock``
|
||||
|
||||
A combined date / time picker. The keyword arguments ``required`` (default: True), ``help_text`` and ``format`` are accepted.
|
||||
|
||||
|
|
@ -187,14 +187,14 @@ A combined date / time picker. The keyword arguments ``required`` (default: True
|
|||
RichTextBlock
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.RichTextBlock``
|
||||
``wagtail.core.blocks.RichTextBlock``
|
||||
|
||||
A WYSIWYG editor for creating formatted text including links, bold / italics etc. The keyword argument ``features`` is accepted, to specify the set of features allowed (see :ref:`rich_text_features`).
|
||||
|
||||
RawHTMLBlock
|
||||
~~~~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.RawHTMLBlock``
|
||||
``wagtail.core.blocks.RawHTMLBlock``
|
||||
|
||||
A text area for entering raw HTML which will be rendered unescaped in the page output. The keyword arguments ``required`` (default: True), ``max_length``, ``min_length`` and ``help_text`` are accepted.
|
||||
|
||||
|
|
@ -204,7 +204,7 @@ A text area for entering raw HTML which will be rendered unescaped in the page o
|
|||
BlockQuoteBlock
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.BlockQuoteBlock``
|
||||
``wagtail.core.blocks.BlockQuoteBlock``
|
||||
|
||||
A text field, the contents of which will be wrapped in an HTML `<blockquote>` tag pair. The keyword arguments ``required`` (default: True), ``max_length``, ``min_length`` and ``help_text`` are accepted.
|
||||
|
||||
|
|
@ -212,7 +212,7 @@ A text field, the contents of which will be wrapped in an HTML `<blockquote>` ta
|
|||
ChoiceBlock
|
||||
~~~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.ChoiceBlock``
|
||||
``wagtail.core.blocks.ChoiceBlock``
|
||||
|
||||
A dropdown select box for choosing from a list of choices. The following keyword arguments are accepted:
|
||||
|
||||
|
|
@ -254,7 +254,7 @@ could be rewritten as a subclass of ChoiceBlock:
|
|||
PageChooserBlock
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.PageChooserBlock``
|
||||
``wagtail.core.blocks.PageChooserBlock``
|
||||
|
||||
A control for selecting a page object, using Wagtail's page browser. The following keyword arguments are accepted:
|
||||
|
||||
|
|
@ -301,7 +301,7 @@ A field for the editor to enter a URL to a media item (such as a YouTube video)
|
|||
StaticBlock
|
||||
~~~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.StaticBlock``
|
||||
``wagtail.core.blocks.StaticBlock``
|
||||
|
||||
A block which doesn't have any fields, thus passes no particular values to its template during rendering. This can be useful if you need the editor to be able to insert some content which is always the same or doesn't need to be configured within the page editor, such as an address, embed code from third-party services, or more complex pieces of code if the template uses template tags.
|
||||
|
||||
|
|
@ -334,7 +334,7 @@ In addition to the basic block types above, it is possible to define new block t
|
|||
StructBlock
|
||||
~~~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.StructBlock``
|
||||
``wagtail.core.blocks.StructBlock``
|
||||
|
||||
A block consisting of a fixed group of sub-blocks to be displayed together. Takes a list of ``(name, block_definition)`` tuples as its first argument:
|
||||
|
||||
|
|
@ -381,7 +381,7 @@ Further options are available for customising the display of a ``StructBlock`` w
|
|||
ListBlock
|
||||
~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.ListBlock``
|
||||
``wagtail.core.blocks.ListBlock``
|
||||
|
||||
A block consisting of many sub-blocks, all of the same type. The editor can add an unlimited number of sub-blocks, and re-order and delete them. Takes the definition of the sub-block as its first argument:
|
||||
|
||||
|
|
@ -403,7 +403,7 @@ Any block type is valid as the sub-block type, including structural types:
|
|||
StreamBlock
|
||||
~~~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailcore.blocks.StreamBlock``
|
||||
``wagtail.core.blocks.StreamBlock``
|
||||
|
||||
A block consisting of a sequence of sub-blocks of different types, which can be mixed and reordered at will. Used as the overall mechanism of the StreamField itself, but can also be nested or used within other structural block types. Takes a list of ``(name, block_definition)`` tuples as its first argument:
|
||||
|
||||
|
|
@ -469,7 +469,7 @@ This example demonstrates how the basic block types introduced above can be comb
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore import blocks
|
||||
from wagtail.core import blocks
|
||||
|
||||
class PersonBlock(blocks.StructBlock):
|
||||
name = blocks.CharBlock()
|
||||
|
|
@ -853,7 +853,7 @@ Custom block types
|
|||
|
||||
If you need to implement a custom UI, or handle a datatype that is not provided by Wagtail's built-in block types (and cannot built up as a structure of existing fields), it is possible to define your own custom block types. For further guidance, refer to the source code of Wagtail's built-in block classes.
|
||||
|
||||
For block types that simply wrap an existing Django form field, Wagtail provides an abstract class ``wagtail.wagtailcore.blocks.FieldBlock`` as a helper. Subclasses just need to set a ``field`` property that returns the form field object:
|
||||
For block types that simply wrap an existing Django form field, Wagtail provides an abstract class ``wagtail.core.blocks.FieldBlock`` as a helper. Subclasses just need to set a ``field`` property that returns the form field object:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
|
@ -888,7 +888,7 @@ If you change an existing RichTextField to a StreamField, and create and run mig
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
from wagtail.wagtailcore.rich_text import RichText
|
||||
from wagtail.core.rich_text import RichText
|
||||
|
||||
|
||||
def convert_to_streamfield(apps, schema_editor):
|
||||
|
|
@ -938,7 +938,7 @@ Note that the above migration will work on published Page objects only. If you a
|
|||
from django.core.serializers.json import DjangoJSONEncoder
|
||||
from django.db import migrations, models
|
||||
|
||||
from wagtail.wagtailcore.rich_text import RichText
|
||||
from wagtail.core.rich_text import RichText
|
||||
|
||||
|
||||
def page_to_streamfield(page):
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ from rest_framework.response import Response
|
|||
from rest_framework.viewsets import GenericViewSet
|
||||
|
||||
from wagtail.api import APIField
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.core.models import Page
|
||||
|
||||
from .filters import (
|
||||
FieldsFilter, OrderingFilter, RestrictedChildOfFilter, RestrictedDescendantOfFilter,
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ from django.db import models
|
|||
from rest_framework.filters import BaseFilterBackend
|
||||
from taggit.managers import TaggableManager
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.core import hooks
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.wagtailsearch.backends import get_search_backend
|
||||
|
||||
from .utils import BadRequestError, pages_for_site, parse_boolean
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from rest_framework import relations, serializers
|
|||
from rest_framework.fields import Field, SkipField
|
||||
from taggit.managers import _TaggableManager
|
||||
|
||||
from wagtail.wagtailcore import fields as wagtailcore_fields
|
||||
from wagtail.core import fields as wagtailcore_fields
|
||||
|
||||
from .utils import get_full_url, pages_for_site
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ from django.db.models.signals import post_delete, post_save
|
|||
from django.urls import reverse
|
||||
|
||||
from wagtail.contrib.wagtailfrontendcache.utils import purge_url_from_cache
|
||||
from wagtail.wagtailcore.models import get_page_models
|
||||
from wagtail.wagtailcore.signals import page_published, page_unpublished
|
||||
from wagtail.core.models import get_page_models
|
||||
from wagtail.core.signals import page_published, page_unpublished
|
||||
from wagtail.wagtaildocs.models import get_document_model
|
||||
from wagtail.wagtailimages import get_image_model
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ from django.urls import reverse
|
|||
from wagtail.api.v2 import signal_handlers
|
||||
from wagtail.tests.demosite import models
|
||||
from wagtail.tests.testapp.models import StreamPage
|
||||
from wagtail.wagtailcore.models import Page, Site
|
||||
from wagtail.core.models import Page, Site
|
||||
|
||||
|
||||
def get_total_page_count():
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ from urllib.parse import urlparse
|
|||
|
||||
from django.conf import settings
|
||||
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.wagtailcore.utils import resolve_model_string
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.core.utils import resolve_model_string
|
||||
|
||||
|
||||
class BadRequestError(Exception):
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from django import forms
|
|||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.core.models import Page
|
||||
|
||||
|
||||
class PageChoiceField(forms.ModelChoiceField):
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from django.contrib.auth import get_permission_codename
|
|||
from django.contrib.auth.models import Permission
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
|
||||
from wagtail.wagtailcore.models import Page, UserPagePermissionsProxy
|
||||
from wagtail.core.models import Page, UserPagePermissionsProxy
|
||||
|
||||
|
||||
class PermissionHelper(object):
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ from django.core.exceptions import ImproperlyConfigured
|
|||
from django.db.models import Model
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.core import hooks
|
||||
from wagtail.core.models import Page
|
||||
|
||||
from .helpers import (
|
||||
AdminURLHelper, ButtonHelper, PageAdminURLHelper, PageButtonHelper, PagePermissionHelper,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from django.test import TestCase
|
|||
|
||||
from wagtail.tests.testapp.models import BusinessIndex, EventCategory, EventPage
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.wagtailcore.models import GroupPagePermission, Page
|
||||
from wagtail.core.models import GroupPagePermission, Page
|
||||
|
||||
|
||||
class TestIndexView(TestCase, WagtailTestUtils):
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from __future__ import absolute_import, unicode_literals
|
|||
from django import forms
|
||||
from django.urls import reverse
|
||||
|
||||
from wagtail.wagtailcore.models import Site
|
||||
from wagtail.core.models import Site
|
||||
|
||||
|
||||
class SiteSwitchForm(forms.Form):
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from django.utils.encoding import force_str
|
|||
from jinja2.ext import Extension
|
||||
|
||||
from wagtail.contrib.settings.registry import registry
|
||||
from wagtail.wagtailcore.models import Site
|
||||
from wagtail.core.models import Site
|
||||
|
||||
# Settings are cached per template context, to prevent excessive database
|
||||
# lookups. The cached settings are disposed of once the template context is no
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from django.urls import reverse
|
|||
from django.utils.text import capfirst
|
||||
|
||||
from wagtail.wagtailadmin.menu import MenuItem
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
from .permissions import user_can_edit_setting_type
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from __future__ import absolute_import, unicode_literals
|
|||
|
||||
from django.template import Library
|
||||
|
||||
from wagtail.wagtailcore.models import Site
|
||||
from wagtail.core.models import Site
|
||||
|
||||
from ..context_processors import SettingsProxy
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ from wagtail.contrib.settings.views import get_setting_edit_handler
|
|||
from wagtail.tests.testapp.models import (
|
||||
FileUploadSetting, IconSetting, PanelSettings, TabbedSettings, TestSetting)
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.wagtailcore.models import Page, Site
|
||||
from wagtail.core import hooks
|
||||
from wagtail.core.models import Page, Site
|
||||
|
||||
|
||||
class TestSettingMenu(TestCase, WagtailTestUtils):
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from django.test import TestCase
|
|||
|
||||
from wagtail.tests.testapp.models import TestSetting
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.wagtailcore.models import Page, Site
|
||||
from wagtail.core.models import Page, Site
|
||||
|
||||
|
||||
class TemplateTestCase(TestCase, WagtailTestUtils):
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from django.utils.translation import ugettext as _
|
|||
from wagtail.wagtailadmin import messages
|
||||
from wagtail.wagtailadmin.edit_handlers import (
|
||||
ObjectList, extract_panel_definitions_from_model_class)
|
||||
from wagtail.wagtailcore.models import Site
|
||||
from wagtail.core.models import Site
|
||||
|
||||
from .forms import SiteSwitchForm
|
||||
from .permissions import user_can_edit_setting_type
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from __future__ import absolute_import, unicode_literals
|
|||
|
||||
from django.conf.urls import include, url
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
from . import urls
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from django.utils import translation
|
|||
from django.utils.functional import cached_property
|
||||
|
||||
from wagtail.utils.widgets import WidgetWithScript
|
||||
from wagtail.wagtailcore.blocks import FieldBlock
|
||||
from wagtail.core.blocks import FieldBlock
|
||||
|
||||
|
||||
class TableInput(WidgetWithScript, forms.HiddenInput):
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from __future__ import absolute_import, unicode_literals
|
|||
from django.apps import apps
|
||||
|
||||
from wagtail.contrib.wagtailfrontendcache.utils import purge_page_from_cache
|
||||
from wagtail.wagtailcore.signals import page_published, page_unpublished
|
||||
from wagtail.core.signals import page_published, page_unpublished
|
||||
|
||||
|
||||
def page_published_signal_handler(instance, **kwargs):
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from wagtail.contrib.wagtailfrontendcache.backends import (
|
|||
BaseBackend, CloudflareBackend, CloudfrontBackend, HTTPBackend)
|
||||
from wagtail.contrib.wagtailfrontendcache.utils import get_backends
|
||||
from wagtail.tests.testapp.models import EventIndex
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.core.models import Page
|
||||
|
||||
from .utils import (
|
||||
PurgeBatch, purge_page_from_cache, purge_pages_from_cache, purge_url_from_cache,
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ from django.http import Http404
|
|||
from django.template.response import TemplateResponse
|
||||
from django.urls.resolvers import RegexURLResolver
|
||||
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.wagtailcore.url_routing import RouteResult
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.core.url_routing import RouteResult
|
||||
|
||||
_creation_counter = 0
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from wagtail.contrib.wagtailroutablepage.templatetags.wagtailroutablepage_tags i
|
|||
routablepageurl
|
||||
from wagtail.tests.routablepage.models import (
|
||||
RoutablePageTest, RoutablePageWithOverriddenIndexRouteTest)
|
||||
from wagtail.wagtailcore.models import Page, Site
|
||||
from wagtail.core.models import Page, Site
|
||||
|
||||
|
||||
class TestRoutablePage(TestCase):
|
||||
|
|
@ -188,7 +188,7 @@ class TestRoutablePageTemplateTag(TestCase):
|
|||
self.assertEqual(url, self.routable_page.url + 'external/joe-bloggs/')
|
||||
|
||||
def test_templatetag_reverse_external_view_without_append_slash(self):
|
||||
with mock.patch('wagtail.wagtailcore.models.WAGTAIL_APPEND_SLASH', False):
|
||||
with mock.patch('wagtail.core.models.WAGTAIL_APPEND_SLASH', False):
|
||||
url = routablepageurl(self.context, self.routable_page,
|
||||
'external_view', 'joe-bloggs')
|
||||
expected = self.routable_page.url + '/' + 'external/joe-bloggs/'
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from django.utils.translation import ugettext_lazy as _
|
|||
|
||||
from wagtail.contrib.wagtailsearchpromotions import admin_urls
|
||||
from wagtail.wagtailadmin.menu import MenuItem
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
|
||||
@hooks.register('register_admin_urls')
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from django.contrib.sites.shortcuts import get_current_site
|
|||
from django.test import RequestFactory, TestCase
|
||||
|
||||
from wagtail.tests.testapp.models import EventIndex, SimplePage
|
||||
from wagtail.wagtailcore.models import Page, PageViewRestriction, Site
|
||||
from wagtail.core.models import Page, PageViewRestriction, Site
|
||||
|
||||
from .sitemap_generator import Sitemap
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from wagtail.wagtailadmin.forms import SearchForm
|
|||
from wagtail.wagtailadmin.rich_text import get_rich_text_editor_widget
|
||||
from wagtail.wagtailadmin.widgets import (
|
||||
AdminAutoHeightTextInput, AdminDateInput, AdminDateTimeInput, AdminPageChooser, AdminTimeInput)
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.wagtaildocs.widgets import AdminDocumentChooser
|
||||
from wagtail.wagtailimages.widgets import AdminImageChooser
|
||||
from wagtail.wagtailsnippets.widgets import AdminSnippetChooser
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from django.urls import reverse
|
|||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from wagtail.wagtailadmin.menu import MenuItem
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
from . import views
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from __future__ import absolute_import, unicode_literals
|
|||
# Imported for historical reasons
|
||||
from wagtail import __semver__, __version__ # noqa
|
||||
|
||||
default_app_config = 'wagtail.wagtailcore.apps.WagtailCoreAppConfig'
|
||||
default_app_config = 'wagtail.core.apps.WagtailCoreAppConfig'
|
||||
|
||||
|
||||
def setup():
|
||||
|
|
@ -4,7 +4,7 @@ from django.contrib import admin
|
|||
from django.contrib.auth.admin import GroupAdmin
|
||||
from django.contrib.auth.models import Group
|
||||
|
||||
from wagtail.wagtailcore.models import GroupPagePermission, Page, Site
|
||||
from wagtail.core.models import GroupPagePermission, Page, Site
|
||||
|
||||
admin.site.register(Site)
|
||||
admin.site.register(Page)
|
||||
|
|
@ -4,10 +4,10 @@ from django.apps import AppConfig
|
|||
|
||||
|
||||
class WagtailCoreAppConfig(AppConfig):
|
||||
name = 'wagtail.wagtailcore'
|
||||
name = 'wagtail.core'
|
||||
label = 'wagtailcore'
|
||||
verbose_name = "Wagtail core"
|
||||
|
||||
def ready(self):
|
||||
from wagtail.wagtailcore.signal_handlers import register_signal_handlers
|
||||
from wagtail.core.signal_handlers import register_signal_handlers
|
||||
register_signal_handlers()
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
# Import block types defined in submodules into the wagtail.wagtailcore.blocks namespace
|
||||
# Import block types defined in submodules into the wagtail.core.blocks namespace
|
||||
from .base import * # NOQA
|
||||
from .field_block import * # NOQA
|
||||
from .struct_block import * # NOQA
|
||||
|
|
@ -390,7 +390,7 @@ class Block(six.with_metaclass(BaseBlock, object)):
|
|||
# in all of these cases, including reporting StructBlock as the path:
|
||||
#
|
||||
# FooBlock().deconstruct() == (
|
||||
# 'wagtail.wagtailcore.blocks.StructBlock',
|
||||
# 'wagtail.core.blocks.StructBlock',
|
||||
# [('first_name', CharBlock()), ('surname': CharBlock())],
|
||||
# {}
|
||||
# )
|
||||
|
|
@ -531,5 +531,5 @@ class BlockField(forms.Field):
|
|||
|
||||
|
||||
DECONSTRUCT_ALIASES = {
|
||||
Block: 'wagtail.wagtailcore.blocks.Block',
|
||||
Block: 'wagtail.core.blocks.Block',
|
||||
}
|
||||
|
|
@ -12,8 +12,8 @@ from django.utils.functional import cached_property
|
|||
from django.utils.html import format_html
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
from wagtail.wagtailcore.rich_text import RichText
|
||||
from wagtail.wagtailcore.utils import resolve_model_string
|
||||
from wagtail.core.rich_text import RichText
|
||||
from wagtail.core.utils import resolve_model_string
|
||||
|
||||
from .base import Block
|
||||
|
||||
|
|
@ -426,7 +426,7 @@ class ChoiceBlock(FieldBlock):
|
|||
users to define subclasses of ChoiceBlock in their models.py, with specific choice lists
|
||||
passed in, without references to those classes ending up frozen into migrations.
|
||||
"""
|
||||
return ('wagtail.wagtailcore.blocks.ChoiceBlock', [], self._constructor_kwargs)
|
||||
return ('wagtail.core.blocks.ChoiceBlock', [], self._constructor_kwargs)
|
||||
|
||||
def get_searchable_content(self, value):
|
||||
# Return the display value as the searchable value
|
||||
|
|
@ -676,7 +676,7 @@ block_classes = [
|
|||
DecimalBlock, RegexBlock, BlockQuoteBlock
|
||||
]
|
||||
DECONSTRUCT_ALIASES = {
|
||||
cls: 'wagtail.wagtailcore.blocks.%s' % cls.__name__
|
||||
cls: 'wagtail.core.blocks.%s' % cls.__name__
|
||||
for cls in block_classes
|
||||
}
|
||||
__all__ = [cls.__name__ for cls in block_classes]
|
||||
|
|
@ -8,7 +8,7 @@ from django.template.loader import render_to_string
|
|||
from django.utils.html import format_html, format_html_join
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
from wagtail.wagtailcore.utils import escape_script
|
||||
from wagtail.core.utils import escape_script
|
||||
|
||||
from .base import Block
|
||||
from .utils import js_dict
|
||||
|
|
@ -181,5 +181,5 @@ class ListBlock(Block):
|
|||
|
||||
|
||||
DECONSTRUCT_ALIASES = {
|
||||
ListBlock: 'wagtail.wagtailcore.blocks.ListBlock',
|
||||
ListBlock: 'wagtail.core.blocks.ListBlock',
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ from django.utils.html import format_html_join
|
|||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from wagtail.wagtailcore.utils import escape_script
|
||||
from wagtail.core.utils import escape_script
|
||||
|
||||
from .base import Block, BoundBlock, DeclarativeSubBlocksMetaclass
|
||||
from .utils import indent, js_dict
|
||||
|
|
@ -296,7 +296,7 @@ class BaseStreamBlock(Block):
|
|||
This ensures that the field definitions get frozen into migrations, rather than leaving a reference
|
||||
to a custom subclass in the user's models.py that may or may not stick around.
|
||||
"""
|
||||
path = 'wagtail.wagtailcore.blocks.StreamBlock'
|
||||
path = 'wagtail.core.blocks.StreamBlock'
|
||||
args = [self.child_blocks.items()]
|
||||
kwargs = self._constructor_kwargs
|
||||
return (path, args, kwargs)
|
||||
|
|
@ -162,7 +162,7 @@ class BaseStructBlock(Block):
|
|||
This ensures that the field definitions get frozen into migrations, rather than leaving a reference
|
||||
to a custom subclass in the user's models.py that may or may not stick around.
|
||||
"""
|
||||
path = 'wagtail.wagtailcore.blocks.StructBlock'
|
||||
path = 'wagtail.core.blocks.StructBlock'
|
||||
args = [self.child_blocks.items()]
|
||||
kwargs = self._constructor_kwargs
|
||||
return (path, args, kwargs)
|
||||
|
|
@ -5,7 +5,7 @@ import json
|
|||
from django.core.serializers.json import DjangoJSONEncoder
|
||||
from django.db import models
|
||||
|
||||
from wagtail.wagtailcore.blocks import Block, BlockField, StreamBlock, StreamValue
|
||||
from wagtail.core.blocks import Block, BlockField, StreamBlock, StreamValue
|
||||
|
||||
|
||||
class RichTextField(models.TextField):
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue