kopia lustrzana https://github.com/wagtail/wagtail
Merge branch 'master' into search-query-api
# Conflicts: # wagtail/contrib/postgres_search/backend.py # wagtail/contrib/postgres_search/utils.py # wagtail/core/tests/test_page_queryset.py # wagtail/search/backends/base.py # wagtail/search/backends/db.py # wagtail/search/backends/elasticsearch2.py # wagtail/search/queryset.py # wagtail/search/tests/elasticsearch_common_tests.py # wagtail/search/tests/test_backends.py # wagtail/search/tests/test_elasticsearch2_backend.py # wagtail/search/tests/test_elasticsearch5_backend.py # wagtail/search/utils.pypull/4059/head
commit
0bcf6a110d
52
.tx/config
52
.tx/config
|
@ -2,80 +2,80 @@
|
|||
host = https://www.transifex.com
|
||||
|
||||
[wagtail.wagtailadmin]
|
||||
file_filter = wagtail/wagtailadmin/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/wagtailadmin/locale/en/LC_MESSAGES/django.po
|
||||
file_filter = wagtail/admin/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/admin/locale/en/LC_MESSAGES/django.po
|
||||
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
|
||||
|
||||
[wagtail.wagtaildocs]
|
||||
file_filter = wagtail/wagtaildocs/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/wagtaildocs/locale/en/LC_MESSAGES/django.po
|
||||
file_filter = wagtail/documents/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/documents/locale/en/LC_MESSAGES/django.po
|
||||
source_lang = en
|
||||
type = PO
|
||||
|
||||
[wagtail.wagtailimages]
|
||||
file_filter = wagtail/wagtailimages/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/wagtailimages/locale/en/LC_MESSAGES/django.po
|
||||
file_filter = wagtail/images/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/images/locale/en/LC_MESSAGES/django.po
|
||||
source_lang = en
|
||||
type = PO
|
||||
|
||||
[wagtail.wagtailembeds]
|
||||
file_filter = wagtail/wagtailembeds/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/wagtailembeds/locale/en/LC_MESSAGES/django.po
|
||||
file_filter = wagtail/embeds/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/embeds/locale/en/LC_MESSAGES/django.po
|
||||
source_lang = en
|
||||
type = PO
|
||||
|
||||
[wagtail.wagtailredirects]
|
||||
file_filter = wagtail/wagtailredirects/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/wagtailredirects/locale/en/LC_MESSAGES/django.po
|
||||
file_filter = wagtail/contrib/redirects/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/contrib/redirects/locale/en/LC_MESSAGES/django.po
|
||||
source_lang = en
|
||||
type = PO
|
||||
|
||||
[wagtail.wagtailsearch]
|
||||
file_filter = wagtail/wagtailsearch/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/wagtailsearch/locale/en/LC_MESSAGES/django.po
|
||||
file_filter = wagtail/search/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/search/locale/en/LC_MESSAGES/django.po
|
||||
source_lang = en
|
||||
type = PO
|
||||
|
||||
[wagtail.wagtailsnippets]
|
||||
file_filter = wagtail/wagtailsnippets/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/wagtailsnippets/locale/en/LC_MESSAGES/django.po
|
||||
file_filter = wagtail/snippets/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/snippets/locale/en/LC_MESSAGES/django.po
|
||||
source_lang = en
|
||||
type = PO
|
||||
|
||||
[wagtail.wagtailusers]
|
||||
file_filter = wagtail/wagtailusers/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/wagtailusers/locale/en/LC_MESSAGES/django.po
|
||||
file_filter = wagtail/users/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/users/locale/en/LC_MESSAGES/django.po
|
||||
source_lang = en
|
||||
type = PO
|
||||
|
||||
[wagtail.wagtailforms]
|
||||
file_filter = wagtail/wagtailforms/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/wagtailforms/locale/en/LC_MESSAGES/django.po
|
||||
file_filter = wagtail/contrib/forms/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/contrib/forms/locale/en/LC_MESSAGES/django.po
|
||||
source_lang = en
|
||||
type = PO
|
||||
|
||||
[wagtail.wagtailsites]
|
||||
file_filter = wagtail/wagtailsites/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/wagtailsites/locale/en/LC_MESSAGES/django.po
|
||||
file_filter = wagtail/sites/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/sites/locale/en/LC_MESSAGES/django.po
|
||||
source_lang = en
|
||||
type = PO
|
||||
|
||||
[wagtail.wagtailsearchpromotions]
|
||||
file_filter = wagtail/contrib/wagtailsearchpromotions/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/contrib/wagtailsearchpromotions/locale/en/LC_MESSAGES/django.po
|
||||
file_filter = wagtail/contrib/search_promotions/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/contrib/search_promotions/locale/en/LC_MESSAGES/django.po
|
||||
source_lang = en
|
||||
type = PO
|
||||
|
||||
[wagtail.wagtailstyleguide]
|
||||
file_filter = wagtail/contrib/wagtailstyleguide/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/contrib/wagtailstyleguide/locale/en/LC_MESSAGES/django.po
|
||||
file_filter = wagtail/contrib/styleguide/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/contrib/styleguide/locale/en/LC_MESSAGES/django.po
|
||||
source_lang = en
|
||||
type = PO
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ Changelog
|
|||
* Added `exclude_fields_in_copy` property to Page to define fields that should not be included on page copy (LB (Ben Johnston))
|
||||
* Improved error message on incorrect `{% image %}` tag syntax (LB (Ben Johnston))
|
||||
* Optimized preview data storage (Bertrand Bordage)
|
||||
* Added `render_landing_page` method to `AbstractForm` to be easily overridden and pass `form_submission` to landing page context (Stein Strindhaug)
|
||||
* Fix: Do not remove stopwords when generating slugs from non-ASCII titles, to avoid issues with incorrect word boundaries (Sævar Öfjörð Magnússon)
|
||||
* Fix: The PostgreSQL search backend now preserves ordering of the `QuerySet` when searching with `order_by_relevance=False` (Bertrand Bordage)
|
||||
* Fix: Using `modeladmin_register` as a decorator no longer replaces the decorated class with `None` (Tim Heap)
|
||||
|
|
|
@ -64,7 +64,7 @@ Community Support
|
|||
~~~~~~~~~~~~~~~~~
|
||||
There is an active community of Wagtail users and developers responding to questions on `Stack Overflow <http://stackoverflow.com/questions/tagged/wagtail>`_. When posting questions, please read Stack Overflow's advice on `how to ask questions <http://stackoverflow.com/help/how-to-ask>`_ and remember to tag your question with "wagtail".
|
||||
|
||||
For topics and discussions that do not fit Stack Overflow's question-and-answer format, there is also a `Wagtail Support mailing list <https://groups.google.com/forum/#!forum/wagtail>`_.
|
||||
For topics and discussions that do not fit Stack Overflow's question-and-answer format, there is also a `Wagtail Support mailing list <https://groups.google.com/forum/#!forum/wagtail>`_ and a `Slack workspace <https://github.com/wagtail/wagtail/wiki/Slack>`_.
|
||||
|
||||
Commercial Support
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -9,7 +9,7 @@ dependencies:
|
|||
test:
|
||||
override:
|
||||
- flake8 wagtail
|
||||
- isort --check-only --diff --recursive wagtail
|
||||
# - isort --check-only --diff --recursive wagtail
|
||||
- npm run lint:js
|
||||
- npm run lint:css
|
||||
- python -u runtests.py
|
||||
|
|
|
@ -2,9 +2,9 @@ const path = require('path');
|
|||
const webpack = require('webpack');
|
||||
|
||||
// Generates a path to an entry file to be compiled by Webpack.
|
||||
const getEntryPath = (app, filename) => path.resolve('wagtail', app, 'static_src', app, 'app', filename);
|
||||
const getEntryPath = (app, filename) => path.resolve('wagtail', app, 'static_src', `wagtail${app}`, 'app', filename);
|
||||
// Generates a path to the output bundle to be loaded in the browser.
|
||||
const getOutputPath = (app, filename) => path.join('wagtail', app, 'static', app, 'js', filename);
|
||||
const getOutputPath = (app, filename) => path.join('wagtail', app, 'static', `wagtail${app}`, 'js', filename);
|
||||
|
||||
const isVendorModule = (module) => {
|
||||
const res = module.resource;
|
||||
|
@ -19,7 +19,7 @@ module.exports = function exports() {
|
|||
],
|
||||
};
|
||||
|
||||
entry[getOutputPath('wagtailadmin', 'wagtailadmin')] = getEntryPath('wagtailadmin', 'wagtailadmin.entry.js');
|
||||
entry[getOutputPath('admin', 'wagtailadmin')] = getEntryPath('admin', 'wagtailadmin.entry.js');
|
||||
|
||||
return {
|
||||
entry: entry,
|
||||
|
@ -31,7 +31,7 @@ module.exports = function exports() {
|
|||
plugins: [
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'vendor',
|
||||
filename: getOutputPath('wagtailadmin', '[name].js'),
|
||||
filename: getOutputPath('admin', '[name].js'),
|
||||
minChunks: isVendorModule,
|
||||
}),
|
||||
],
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import warnings
|
||||
|
|
|
@ -44,8 +44,8 @@ can hook into the rest of your project.
|
|||
Wagtail provides three endpoint classes you can use:
|
||||
|
||||
- Pages :class:`wagtail.api.v2.endpoints.PagesAPIEndpoint`
|
||||
- Images :class:`wagtail.wagtailimages.api.v2.endpoints.ImagesAPIEndpoint`
|
||||
- Documents :class:`wagtail.wagtaildocs.api.v2.endpoints.DocumentsAPIEndpoint`
|
||||
- Images :class:`wagtail.images.api.v2.endpoints.ImagesAPIEndpoint`
|
||||
- Documents :class:`wagtail.documents.api.v2.endpoints.DocumentsAPIEndpoint`
|
||||
|
||||
You can subclass any of these endpoint classes to customise their functionality.
|
||||
Additionally, there is a base endpoint class you can use for adding different
|
||||
|
@ -60,8 +60,8 @@ types in their default configuration:
|
|||
|
||||
from wagtail.api.v2.endpoints import PagesAPIEndpoint
|
||||
from wagtail.api.v2.router import WagtailAPIRouter
|
||||
from wagtail.wagtailimages.api.v2.endpoints import ImagesAPIEndpoint
|
||||
from wagtail.wagtaildocs.api.v2.endpoints import DocumentsAPIEndpoint
|
||||
from wagtail.images.api.v2.endpoints import ImagesAPIEndpoint
|
||||
from wagtail.documents.api.v2.endpoints import DocumentsAPIEndpoint
|
||||
|
||||
# Create the router. "wagtailapi" is the URL namespace
|
||||
api_router = WagtailAPIRouter('wagtailapi')
|
||||
|
@ -195,7 +195,7 @@ This adds two fields to the API (other fields omitted for brevity):
|
|||
Images in the API
|
||||
-----------------
|
||||
|
||||
The :class:`~wagtail.wagtailimages.api.fields.ImageRenditionField` serialiser
|
||||
The :class:`~wagtail.images.api.fields.ImageRenditionField` serialiser
|
||||
allows you to add renditions of images into your API. It requires an image
|
||||
filter string specifying the resize operations to perform on the image. It can
|
||||
also take the ``source`` keyword argument described above.
|
||||
|
@ -204,7 +204,7 @@ For example:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailimages.api.fields import ImageRenditionField
|
||||
from wagtail.images.api.fields import ImageRenditionField
|
||||
|
||||
class BlogPage(Page):
|
||||
...
|
||||
|
|
|
@ -4,7 +4,7 @@ Customising admin templates
|
|||
|
||||
In your projects with Wagtail, you may wish to replace elements such as the Wagtail logo within the admin interface with your own branding. This can be done through Django's template inheritance mechanism.
|
||||
|
||||
You need to create a ``templates/wagtailadmin/`` folder within one of your apps - this may be an existing one, or a new one created for this purpose, for example, ``dashboard``. This app must be registered in ``INSTALLED_APPS`` before ``wagtail.wagtailadmin``:
|
||||
You need to create a ``templates/wagtailadmin/`` folder within one of your apps - this may be an existing one, or a new one created for this purpose, for example, ``dashboard``. This app must be registered in ``INSTALLED_APPS`` before ``wagtail.admin``:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
@ -13,8 +13,8 @@ You need to create a ``templates/wagtailadmin/`` folder within one of your apps
|
|||
|
||||
'dashboard',
|
||||
|
||||
'wagtail.wagtailcore',
|
||||
'wagtail.wagtailadmin',
|
||||
'wagtail.core',
|
||||
'wagtail.admin',
|
||||
|
||||
# ...
|
||||
)
|
||||
|
|
|
@ -30,7 +30,7 @@ Create your custom user create and edit forms in your app:
|
|||
from django import forms
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from wagtail.wagtailusers.forms import UserEditForm, UserCreationForm
|
||||
from wagtail.users.forms import UserEditForm, UserCreationForm
|
||||
|
||||
from users.models import MembershipStatus
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ As standard, Wagtail organises panels for pages into three tabs: 'Content', 'Pro
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailadmin.edit_handlers import TabbedInterface, ObjectList
|
||||
from wagtail.admin.edit_handlers import TabbedInterface, ObjectList
|
||||
|
||||
class BlogPage(Page):
|
||||
# field definitions omitted
|
||||
|
@ -38,12 +38,12 @@ 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.wagtailadmin.edit_handlers import FieldPanel
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.admin.edit_handlers import FieldPanel
|
||||
|
||||
|
||||
class BookPage(Page):
|
||||
|
@ -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:
|
||||
|
@ -96,8 +96,8 @@ 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.admin.rich_text import HalloPlugin
|
||||
from wagtail.core import hooks
|
||||
|
||||
@hooks.register('register_rich_text_features')
|
||||
def register_embed_feature(features):
|
||||
|
@ -141,14 +141,14 @@ 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:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# image_formats.py
|
||||
from wagtail.wagtailimages.formats import Format, register_image_format
|
||||
from wagtail.images.formats import Format, register_image_format
|
||||
|
||||
register_image_format(Format('thumbnail', 'Thumbnail', 'richtext-image thumbnail', 'max-120x120'))
|
||||
|
||||
|
@ -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.
|
||||
|
@ -178,15 +178,15 @@ To unregister, call ``unregister_image_format`` with the string of the ``name``
|
|||
Customising generated forms
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. class:: wagtail.wagtailadmin.forms.WagtailAdminModelForm
|
||||
.. class:: wagtail.wagtailadmin.forms.WagtailAdminPageForm
|
||||
.. class:: wagtail.admin.forms.WagtailAdminModelForm
|
||||
.. class:: wagtail.admin.forms.WagtailAdminPageForm
|
||||
|
||||
Wagtail automatically generates forms using the panels configured on the model.
|
||||
By default, this form subclasses :class:`~wagtail.wagtailadmin.forms.WagtailAdminModelForm`,
|
||||
or :class:`~wagtail.wagtailadmin.forms.WagtailAdminPageForm` for pages.
|
||||
By default, this form subclasses :class:`~wagtail.admin.forms.WagtailAdminModelForm`,
|
||||
or :class:`~wagtail.admin.forms.WagtailAdminPageForm` for pages.
|
||||
A custom base form class can be configured by setting the :attr:`base_form_class` attribute on any model.
|
||||
Custom forms for snippets must subclass :class:`~wagtail.wagtailadmin.forms.WagtailAdminModelForm`,
|
||||
and custom forms for pages must subclass :class:`~wagtail.wagtailadmin.forms.WagtailAdminPageForm`.
|
||||
Custom forms for snippets must subclass :class:`~wagtail.admin.forms.WagtailAdminModelForm`,
|
||||
and custom forms for pages must subclass :class:`~wagtail.admin.forms.WagtailAdminPageForm`.
|
||||
|
||||
This can be used to add non-model fields to the form, to automatically generate field content,
|
||||
or to add custom validation logic for your models:
|
||||
|
@ -194,9 +194,10 @@ or to add custom validation logic for your models:
|
|||
.. code-block:: python
|
||||
|
||||
from django import forms
|
||||
from wagtail.wagtailadmin.edit_handlers import FieldPanel
|
||||
from wagtail.wagtailadmin.forms import WagtailAdminPageForm
|
||||
from wagtail.wagtailcore.models import Page
|
||||
import geocoder # not in Wagtail, for example only - http://geocoder.readthedocs.io/
|
||||
from wagtail.admin.edit_handlers import FieldPanel
|
||||
from wagtail.admin.forms import WagtailAdminPageForm
|
||||
from wagtail.core.models import Page
|
||||
|
||||
|
||||
class EventPageForm(WagtailAdminPageForm):
|
||||
|
@ -220,7 +221,7 @@ or to add custom validation logic for your models:
|
|||
page.duration = (page.end_date - page.start_date).days
|
||||
|
||||
# Fetch the location by geocoding the address
|
||||
page.location = geocoder.get_coordinates(self.cleaned_data['address'])
|
||||
page.location = geocoder.arcgis(self.cleaned_data['address'])
|
||||
|
||||
if commit:
|
||||
page.save()
|
||||
|
@ -231,9 +232,10 @@ or to add custom validation logic for your models:
|
|||
start_date = models.DateField()
|
||||
end_date = models.DateField()
|
||||
duration = models.IntegerField()
|
||||
location = models.CharField()
|
||||
location = models.CharField(max_length=255)
|
||||
|
||||
content_panels = [
|
||||
FieldPanel('title'),
|
||||
FieldPanel('start_date'),
|
||||
FieldPanel('end_date'),
|
||||
FieldPanel('address'),
|
||||
|
|
|
@ -8,7 +8,7 @@ additional fields.
|
|||
You need to complete the following steps in your project to do this:
|
||||
|
||||
- Create a new document model that inherits from
|
||||
``wagtail.wagtaildocs.models.AbstractDocument``. This is where you would
|
||||
``wagtail.documents.models.AbstractDocument``. This is where you would
|
||||
add additional fields.
|
||||
- Point ``WAGTAILDOCS_DOCUMENT_MODEL`` to the new model.
|
||||
|
||||
|
@ -17,7 +17,7 @@ Here's an example:
|
|||
.. code-block:: python
|
||||
|
||||
# models.py
|
||||
from wagtail.wagtaildocs.models import Document, AbstractDocument
|
||||
from wagtail.documents.models import Document, AbstractDocument
|
||||
|
||||
class CustomDocument(AbstractDocument):
|
||||
# Custom field example:
|
||||
|
@ -62,6 +62,6 @@ Then in your settings module:
|
|||
Referring to the document model
|
||||
===============================
|
||||
|
||||
.. module:: wagtail.wagtaildocs.models
|
||||
.. module:: wagtail.documents.models
|
||||
|
||||
.. autofunction:: get_document_model
|
||||
|
|
|
@ -30,14 +30,14 @@ nest the embed code.
|
|||
``EmbedBlock`` StreamField block type
|
||||
-------------------------------------
|
||||
|
||||
The :class:`~wagtail.wagtailembeds.block.EmbedBlock` block type allows embeds
|
||||
The :class:`~wagtail.embeds.block.EmbedBlock` block type allows embeds
|
||||
to be placed into a ``StreamField``.
|
||||
|
||||
For example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailembeds.blocks import EmbedBlock
|
||||
from wagtail.embeds.blocks import EmbedBlock
|
||||
|
||||
class MyStreamField(blocks.StreamBlock):
|
||||
...
|
||||
|
@ -74,8 +74,8 @@ fetching the embed code.
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailembeds.embeds import get_embed
|
||||
from wagtail.wagtailembeds.exceptions import EmbedException
|
||||
from wagtail.embeds.embeds import get_embed
|
||||
from wagtail.embeds.exceptions import EmbedException
|
||||
|
||||
try:
|
||||
embed = get_embed('https://www.youtube.com/watch?v=SJXMTtvCxRo')
|
||||
|
@ -103,7 +103,7 @@ The default configuration is:
|
|||
|
||||
WAGTAILEMBEDS_FINDERS = [
|
||||
{
|
||||
'class': 'wagtail.wagtailembeds.finders.oembed'
|
||||
'class': 'wagtail.embeds.finders.oembed'
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -132,7 +132,7 @@ and Youtube. It also adds a custom provider:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailembeds.oembed_providers import youtube, vimeo
|
||||
from wagtail.embeds.oembed_providers import youtube, vimeo
|
||||
|
||||
# Add a custom provider
|
||||
# Your custom provider must support oEmbed for this to work. You should be
|
||||
|
@ -148,7 +148,7 @@ and Youtube. It also adds a custom provider:
|
|||
|
||||
WAGTAILEMBEDS_FINDERS = [
|
||||
{
|
||||
'class': 'wagtail.wagtailembeds.finders.oembed',
|
||||
'class': 'wagtail.embeds.finders.oembed',
|
||||
'providers': [youtube, vimeo, my_custom_provider],
|
||||
}
|
||||
]
|
||||
|
@ -164,21 +164,21 @@ For example, this is how you can instruct Youtube to return videos in HTTPS
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailembeds.oembed_providers import youtube
|
||||
from wagtail.embeds.oembed_providers import youtube
|
||||
|
||||
|
||||
WAGTAILEMBEDS_FINDERS = [
|
||||
# Fetches YouTube videos but puts ``?scheme=https`` in the GET parameters
|
||||
# when calling YouTube's oEmbed endpoint
|
||||
{
|
||||
'class': 'wagtail.wagtailembeds.finders.oembed',
|
||||
'class': 'wagtail.embeds.finders.oembed',
|
||||
'providers': [youtube],
|
||||
'options': {'scheme': 'https'}
|
||||
},
|
||||
|
||||
# Handles all other oEmbed providers the default way
|
||||
{
|
||||
'class': 'wagtail.wagtailembeds.finders.oembed',
|
||||
'class': 'wagtail.embeds.finders.oembed',
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -206,13 +206,13 @@ them.
|
|||
|
||||
Wagtail has built in support for fetching embeds from Embed.ly. To use it, add
|
||||
an embed finder to your ``WAGTAILEMBEDS_FINDERS`` setting that uses the
|
||||
``wagtail.wagtailembeds.finders.oembed`` class and pass it your API key:
|
||||
``wagtail.embeds.finders.oembed`` class and pass it your API key:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
WAGTAILEMBEDS_FINDERS = [
|
||||
{
|
||||
'class': 'wagtail.wagtailembeds.finders.embedly',
|
||||
'class': 'wagtail.embeds.finders.embedly',
|
||||
'key': 'YOUR EMBED.LY KEY HERE'
|
||||
}
|
||||
]
|
||||
|
@ -229,7 +229,7 @@ docstrings for details of what each method does:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailembeds.finders.base import EmbedFinder
|
||||
from wagtail.embeds.finders.base import EmbedFinder
|
||||
|
||||
|
||||
class ExampleFinder(EmbedFinder):
|
||||
|
@ -279,7 +279,7 @@ Once you've implemented all of those methods, you just need to add it to your
|
|||
The ``Embed`` model
|
||||
===================
|
||||
|
||||
.. class:: wagtail.wagtailembeds.models.Embed
|
||||
.. class:: wagtail.embeds.models.Embed
|
||||
|
||||
Embeds are fetched only once and stored in the database so subsequent requests
|
||||
for an individual embed do not hit the embed finders again.
|
||||
|
|
|
@ -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,8 +58,8 @@ 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.wagtailadmin.edit_handlers import MultiFieldPanel, PageChooserPanel
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.admin.edit_handlers import MultiFieldPanel, PageChooserPanel
|
||||
|
||||
|
||||
class TranslatablePageMixin(models.Model):
|
||||
|
|
|
@ -87,9 +87,9 @@ This feature is enabled through the project's root URL configuration. Just put t
|
|||
from django.conf import settings
|
||||
from django.contrib import admin
|
||||
|
||||
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.admin import urls as wagtailadmin_urls
|
||||
from wagtail.documents import urls as wagtaildocs_urls
|
||||
from wagtail.core import urls as wagtail_urls
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
|
@ -171,7 +171,7 @@ Copy this into your project and make sure it's imported in any ``models.py`` fil
|
|||
|
||||
from django.utils import translation
|
||||
|
||||
class TranslatedField(object):
|
||||
class TranslatedField:
|
||||
def __init__(self, en_field, fr_field):
|
||||
self.en_field = en_field
|
||||
self.fr_field = fr_field
|
||||
|
|
|
@ -10,10 +10,10 @@ to images.
|
|||
To do this, you need to add two models to your project:
|
||||
|
||||
- The image model itself that inherits from
|
||||
``wagtail.wagtailimages.models.AbstractImage``. This is where you would add
|
||||
``wagtail.images.models.AbstractImage``. This is where you would add
|
||||
your additional fields
|
||||
- The renditions model that inherits from
|
||||
``wagtail.wagtailimages.models.AbstractRendition``. This is used to store
|
||||
``wagtail.images.models.AbstractRendition``. This is used to store
|
||||
renditions for the new model.
|
||||
|
||||
Here's an example:
|
||||
|
@ -23,7 +23,7 @@ Here's an example:
|
|||
# models.py
|
||||
from django.db import models
|
||||
|
||||
from wagtail.wagtailimages.models import Image, AbstractImage, AbstractRendition
|
||||
from wagtail.images.models import Image, AbstractImage, AbstractRendition
|
||||
|
||||
|
||||
class CustomImage(AbstractImage):
|
||||
|
@ -80,7 +80,7 @@ Then set the ``WAGTAILIMAGES_IMAGE_MODEL`` setting to point to it:
|
|||
Referring to the image model
|
||||
============================
|
||||
|
||||
.. module:: wagtail.wagtailimages
|
||||
.. module:: wagtail.images
|
||||
|
||||
.. autofunction:: get_image_model
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ You can manually run feature detection on all images by running the following co
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailimages.models import Image
|
||||
from wagtail.images.models import Image
|
||||
|
||||
for image in Image.objects.all():
|
||||
if not image.has_focal_point():
|
||||
|
|
|
@ -23,7 +23,7 @@ Add an entry for the view into your URLs configuration:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailimages.views.serve import ServeView
|
||||
from wagtail.images.views.serve import ServeView
|
||||
|
||||
urlpatterns = [
|
||||
...
|
||||
|
@ -60,7 +60,7 @@ block the initial response while rendering like the ``{% image %}`` tag does.
|
|||
.. code-block:: python
|
||||
|
||||
from django.urls import reverse
|
||||
from wagtail.wagtailimages.views.serve import generate_signature
|
||||
from wagtail.images.views.serve import generate_signature
|
||||
|
||||
def generate_image_url(image, filter_spec):
|
||||
signature = generate_signature(image.id, filter_spec)
|
||||
|
@ -109,7 +109,7 @@ method in your urls configuration:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailimages.views.serve import ServeView
|
||||
from wagtail.images.views.serve import ServeView
|
||||
|
||||
urlpatterns = [
|
||||
...
|
||||
|
@ -138,7 +138,7 @@ This view can be used out of the box:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailimages.views.serve import SendFileView
|
||||
from wagtail.images.views.serve import SendFileView
|
||||
|
||||
urlpatterns = [
|
||||
...
|
||||
|
@ -151,7 +151,7 @@ setting:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailimages.views.serve import SendFileView
|
||||
from wagtail.images.views.serve import SendFileView
|
||||
from project.sendfile_backends import MyCustomBackend
|
||||
|
||||
class MySendFileView(SendFileView):
|
||||
|
@ -163,7 +163,7 @@ is to be authenticated (e.g. for Django >= 1.9):
|
|||
.. code-block:: python
|
||||
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from wagtail.wagtailimages.views.serve import SendFileView
|
||||
from wagtail.images.views.serve import SendFileView
|
||||
|
||||
class PrivateSendFileView(LoginRequiredMixin, SendFileView):
|
||||
raise_exception = True
|
||||
|
|
|
@ -24,9 +24,9 @@ Django needs to be configured to support Jinja2 templates. As the Wagtail admin
|
|||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'extensions': [
|
||||
'wagtail.wagtailcore.jinja2tags.core',
|
||||
'wagtail.wagtailadmin.jinja2tags.userbar',
|
||||
'wagtail.wagtailimages.jinja2tags.images',
|
||||
'wagtail.core.jinja2tags.core',
|
||||
'wagtail.admin.jinja2tags.userbar',
|
||||
'wagtail.images.jinja2tags.images',
|
||||
],
|
||||
},
|
||||
}
|
||||
|
|
|
@ -37,9 +37,9 @@ Middleware (``settings.py``)
|
|||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
|
||||
'wagtail.wagtailcore.middleware.SiteMiddleware',
|
||||
'wagtail.core.middleware.SiteMiddleware',
|
||||
|
||||
'wagtail.wagtailredirects.middleware.RedirectMiddleware',
|
||||
'wagtail.contrib.redirects.middleware.RedirectMiddleware',
|
||||
]
|
||||
|
||||
Wagtail requires several common Django middleware modules to work and cover basic security. Wagtail provides its own middleware to cover these tasks:
|
||||
|
@ -60,17 +60,17 @@ Apps (``settings.py``)
|
|||
|
||||
'myapp', # your own app
|
||||
|
||||
'wagtail.wagtailforms',
|
||||
'wagtail.wagtailredirects',
|
||||
'wagtail.wagtailembeds',
|
||||
'wagtail.wagtailsites',
|
||||
'wagtail.wagtailusers',
|
||||
'wagtail.wagtailsnippets',
|
||||
'wagtail.wagtaildocs',
|
||||
'wagtail.wagtailimages',
|
||||
'wagtail.wagtailsearch',
|
||||
'wagtail.wagtailadmin',
|
||||
'wagtail.wagtailcore',
|
||||
'wagtail.contrib.forms',
|
||||
'wagtail.contrib.redirects',
|
||||
'wagtail.embeds',
|
||||
'wagtail.sites',
|
||||
'wagtail.users',
|
||||
'wagtail.snippets',
|
||||
'wagtail.documents',
|
||||
'wagtail.images',
|
||||
'wagtail.search',
|
||||
'wagtail.admin',
|
||||
'wagtail.core',
|
||||
|
||||
'taggit',
|
||||
'modelcluster',
|
||||
|
@ -179,7 +179,7 @@ Search
|
|||
|
||||
WAGTAILSEARCH_BACKENDS = {
|
||||
'default': {
|
||||
'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch2',
|
||||
'BACKEND': 'wagtail.search.backends.elasticsearch2',
|
||||
'INDEX': 'myapp'
|
||||
}
|
||||
}
|
||||
|
@ -447,10 +447,10 @@ URL Patterns
|
|||
|
||||
from django.contrib import admin
|
||||
|
||||
from wagtail.wagtailcore 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
|
||||
from wagtail.core import urls as wagtail_urls
|
||||
from wagtail.admin import urls as wagtailadmin_urls
|
||||
from wagtail.documents import urls as wagtaildocs_urls
|
||||
from wagtail.search import urls as wagtailsearch_urls
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^django-admin/', include(admin.site.urls)),
|
||||
|
@ -502,17 +502,17 @@ These two files should reside in your project directory (``myproject/myproject/`
|
|||
INSTALLED_APPS = [
|
||||
'myapp',
|
||||
|
||||
'wagtail.wagtailforms',
|
||||
'wagtail.wagtailredirects',
|
||||
'wagtail.wagtailembeds',
|
||||
'wagtail.wagtailsites',
|
||||
'wagtail.wagtailusers',
|
||||
'wagtail.wagtailsnippets',
|
||||
'wagtail.wagtaildocs',
|
||||
'wagtail.wagtailimages',
|
||||
'wagtail.wagtailsearch',
|
||||
'wagtail.wagtailadmin',
|
||||
'wagtail.wagtailcore',
|
||||
'wagtail.contrib.forms',
|
||||
'wagtail.contrib.redirects',
|
||||
'wagtail.embeds',
|
||||
'wagtail.sites',
|
||||
'wagtail.users',
|
||||
'wagtail.snippets',
|
||||
'wagtail.documents',
|
||||
'wagtail.images',
|
||||
'wagtail.search',
|
||||
'wagtail.admin',
|
||||
'wagtail.core',
|
||||
|
||||
'taggit',
|
||||
'modelcluster',
|
||||
|
@ -534,8 +534,8 @@ These two files should reside in your project directory (``myproject/myproject/`
|
|||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
|
||||
'wagtail.wagtailcore.middleware.SiteMiddleware',
|
||||
'wagtail.wagtailredirects.middleware.RedirectMiddleware',
|
||||
'wagtail.core.middleware.SiteMiddleware',
|
||||
'wagtail.contrib.redirects.middleware.RedirectMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'myproject.urls'
|
||||
|
@ -663,7 +663,7 @@ These two files should reside in your project directory (``myproject/myproject/`
|
|||
# Replace the search backend
|
||||
#WAGTAILSEARCH_BACKENDS = {
|
||||
# 'default': {
|
||||
# 'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch2',
|
||||
# 'BACKEND': 'wagtail.search.backends.elasticsearch2',
|
||||
# 'INDEX': 'myapp'
|
||||
# }
|
||||
#}
|
||||
|
@ -690,10 +690,10 @@ 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.wagtailadmin import urls as wagtailadmin_urls
|
||||
from wagtail.wagtaildocs import urls as wagtaildocs_urls
|
||||
from wagtail.wagtailsearch import urls as wagtailsearch_urls
|
||||
from wagtail.core import urls as wagtail_urls
|
||||
from wagtail.admin import urls as wagtailadmin_urls
|
||||
from wagtail.documents import urls as wagtaildocs_urls
|
||||
from wagtail.search import urls as wagtailsearch_urls
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
|
|
|
@ -72,20 +72,21 @@ 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**
|
||||
|
||||
You can create migrations for the test app by running the following from the Wagtail root.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ django-admin.py makemigrations --settings=wagtail.tests.settings
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ To install the styleguide module on your site, add it to the list of ``INSTALLED
|
|||
|
||||
INSTALLED_APPS = (
|
||||
...
|
||||
'wagtail.contrib.wagtailstyleguide',
|
||||
'wagtail.contrib.styleguide',
|
||||
...
|
||||
)
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ Promoted search results
|
|||
=======================
|
||||
|
||||
.. Note::
|
||||
Promoted search results are an optional Wagtail feature. For details of how to enable them on a Wagtail installation, see :mod:`~wagtail.contrib.wagtailsearchpromotions`
|
||||
Promoted search results are an optional Wagtail feature. For details of how to enable them on a Wagtail installation, see :mod:`~wagtail.contrib.search_promotions`
|
||||
|
||||
|
||||
Wagtail allows you to promote certain search results dependant on the keyword or phrase entered by the user when searching. This can be particularly useful when users commonly refer to parts of your organisation via an acronym that isn't in official use, or if you want to direct users to a page that when they enter a certain term related to the page but not included in the text of the page itself.
|
||||
|
|
|
@ -20,17 +20,17 @@ In your settings file, add the following apps to ``INSTALLED_APPS``:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
'wagtail.wagtailforms',
|
||||
'wagtail.wagtailredirects',
|
||||
'wagtail.wagtailembeds',
|
||||
'wagtail.wagtailsites',
|
||||
'wagtail.wagtailusers',
|
||||
'wagtail.wagtailsnippets',
|
||||
'wagtail.wagtaildocs',
|
||||
'wagtail.wagtailimages',
|
||||
'wagtail.wagtailsearch',
|
||||
'wagtail.wagtailadmin',
|
||||
'wagtail.wagtailcore',
|
||||
'wagtail.contrib.forms',
|
||||
'wagtail.contrib.redirects',
|
||||
'wagtail.embeds',
|
||||
'wagtail.sites',
|
||||
'wagtail.users',
|
||||
'wagtail.snippets',
|
||||
'wagtail.documents',
|
||||
'wagtail.images',
|
||||
'wagtail.search',
|
||||
'wagtail.admin',
|
||||
'wagtail.core',
|
||||
|
||||
'modelcluster',
|
||||
'taggit',
|
||||
|
@ -39,8 +39,8 @@ Add the following entries to ``MIDDLEWARE``:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
'wagtail.wagtailcore.middleware.SiteMiddleware',
|
||||
'wagtail.wagtailredirects.middleware.RedirectMiddleware',
|
||||
'wagtail.core.middleware.SiteMiddleware',
|
||||
'wagtail.contrib.redirects.middleware.RedirectMiddleware',
|
||||
|
||||
Add a ``STATIC_ROOT`` setting, if your project does not have one already:
|
||||
|
||||
|
@ -63,9 +63,9 @@ Now make the following additions to your ``urls.py`` file:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
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.admin import urls as wagtailadmin_urls
|
||||
from wagtail.documents import urls as wagtaildocs_urls
|
||||
from wagtail.core import urls as wagtail_urls
|
||||
|
||||
urlpatterns = [
|
||||
...
|
||||
|
|
|
@ -67,13 +67,11 @@ Edit ``home/models.py`` as follows, to add a ``body`` field to the model:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models
|
||||
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.wagtailadmin.edit_handlers import FieldPanel
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.admin.edit_handlers import FieldPanel
|
||||
|
||||
|
||||
class HomePage(Page):
|
||||
|
@ -164,9 +162,9 @@ 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.wagtailadmin.edit_handlers import FieldPanel
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.admin.edit_handlers import FieldPanel
|
||||
|
||||
|
||||
class BlogIndexPage(Page):
|
||||
|
@ -218,10 +216,10 @@ 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.wagtailadmin.edit_handlers import FieldPanel
|
||||
from wagtail.wagtailsearch import index
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.admin.edit_handlers import FieldPanel
|
||||
from wagtail.search import index
|
||||
|
||||
|
||||
# Keep the definition of BlogIndexPage, and add:
|
||||
|
@ -409,11 +407,11 @@ 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.wagtailadmin.edit_handlers import FieldPanel, InlinePanel
|
||||
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
|
||||
from wagtail.wagtailsearch import index
|
||||
from wagtail.core.models import Page, Orderable
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.admin.edit_handlers import FieldPanel, InlinePanel
|
||||
from wagtail.images.edit_handlers import ImageChooserPanel
|
||||
from wagtail.search import index
|
||||
|
||||
|
||||
# ... (Keep the definition of BlogIndexPage, and update BlogPage:)
|
||||
|
@ -572,11 +570,11 @@ 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.wagtailadmin.edit_handlers import FieldPanel, InlinePanel, MultiFieldPanel
|
||||
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
|
||||
from wagtail.wagtailsearch import index
|
||||
from wagtail.core.models import Page, Orderable
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.admin.edit_handlers import FieldPanel, InlinePanel, MultiFieldPanel
|
||||
from wagtail.images.edit_handlers import ImageChooserPanel
|
||||
from wagtail.search import index
|
||||
|
||||
|
||||
# ... (Keep the definition of BlogIndexPage)
|
||||
|
@ -720,7 +718,7 @@ First, we define a ``BlogCategory`` model. A category is not a page in its own r
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailsnippets.models import register_snippet
|
||||
from wagtail.snippets.models import register_snippet
|
||||
|
||||
|
||||
@register_snippet
|
||||
|
|
|
@ -14,12 +14,12 @@ You can do this as shown below.
|
|||
.. code-block:: python
|
||||
|
||||
from modelcluster.fields import ParentalKey
|
||||
from wagtail.wagtailadmin.edit_handlers import (
|
||||
from wagtail.admin.edit_handlers import (
|
||||
FieldPanel, FieldRowPanel,
|
||||
InlinePanel, MultiFieldPanel
|
||||
)
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormField
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.contrib.forms.models import AbstractEmailForm, AbstractFormField
|
||||
|
||||
|
||||
class FormField(AbstractFormField):
|
||||
|
@ -52,7 +52,7 @@ Custom form submission model
|
|||
If you need to save additional data, you can use a custom form submission model.
|
||||
To do this, you need to:
|
||||
|
||||
* Define a model that extends ``wagtail.wagtailforms.models.AbstractFormSubmission``.
|
||||
* Define a model that extends ``wagtail.contrib.forms.models.AbstractFormSubmission``.
|
||||
* Override the ``get_submission_class`` and ``process_form_submission`` methods in your page model.
|
||||
|
||||
Example:
|
||||
|
@ -65,12 +65,12 @@ Example:
|
|||
from django.core.serializers.json import DjangoJSONEncoder
|
||||
from django.db import models
|
||||
from modelcluster.fields import ParentalKey
|
||||
from wagtail.wagtailadmin.edit_handlers import (
|
||||
from wagtail.admin.edit_handlers import (
|
||||
FieldPanel, FieldRowPanel,
|
||||
InlinePanel, MultiFieldPanel
|
||||
)
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormField, AbstractFormSubmission
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.contrib.forms.models import AbstractEmailForm, AbstractFormField, AbstractFormSubmission
|
||||
|
||||
|
||||
class FormField(AbstractFormField):
|
||||
|
@ -126,12 +126,12 @@ The following example shows how to add a username to the CSV export:
|
|||
from django.core.serializers.json import DjangoJSONEncoder
|
||||
from django.db import models
|
||||
from modelcluster.fields import ParentalKey
|
||||
from wagtail.wagtailadmin.edit_handlers import (
|
||||
from wagtail.admin.edit_handlers import (
|
||||
FieldPanel, FieldRowPanel,
|
||||
InlinePanel, MultiFieldPanel
|
||||
)
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormField, AbstractFormSubmission
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.contrib.forms.models import AbstractEmailForm, AbstractFormField, AbstractFormSubmission
|
||||
|
||||
|
||||
class FormField(AbstractFormField):
|
||||
|
@ -204,12 +204,12 @@ Example:
|
|||
from django.db import models
|
||||
from django.shortcuts import render
|
||||
from modelcluster.fields import ParentalKey
|
||||
from wagtail.wagtailadmin.edit_handlers import (
|
||||
from wagtail.admin.edit_handlers import (
|
||||
FieldPanel, FieldRowPanel,
|
||||
InlinePanel, MultiFieldPanel
|
||||
)
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormField, AbstractFormSubmission
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.contrib.forms.models import AbstractEmailForm, AbstractFormField, AbstractFormSubmission
|
||||
|
||||
|
||||
class FormField(AbstractFormField):
|
||||
|
@ -300,12 +300,12 @@ 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.wagtailadmin.edit_handlers import (
|
||||
from wagtail.admin.edit_handlers import (
|
||||
FieldPanel, FieldRowPanel,
|
||||
InlinePanel, MultiFieldPanel
|
||||
)
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormField
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.contrib.forms.models import AbstractEmailForm, AbstractFormField
|
||||
|
||||
|
||||
class FormField(AbstractFormField):
|
||||
|
@ -383,15 +383,10 @@ The following example shows how to create a multi-step form.
|
|||
# Perform validation again for whole form.
|
||||
# After successful validation, save data into DB,
|
||||
# and remove from the session.
|
||||
self.process_form_submission(form)
|
||||
form_submission = self.process_form_submission(form)
|
||||
del request.session[session_key_data]
|
||||
|
||||
# Render the landing page
|
||||
return render(
|
||||
request,
|
||||
self.landing_page_template,
|
||||
self.get_context(request)
|
||||
)
|
||||
# render the landing page
|
||||
return self.render_landing_page(request, form_submission, *args, **kwargs)
|
||||
else:
|
||||
# If data for step is invalid
|
||||
# we will need to display form again with errors,
|
||||
|
@ -451,12 +446,12 @@ First, you need to collect results as shown below:
|
|||
.. code-block:: python
|
||||
|
||||
from modelcluster.fields import ParentalKey
|
||||
from wagtail.wagtailadmin.edit_handlers import (
|
||||
from wagtail.admin.edit_handlers import (
|
||||
FieldPanel, FieldRowPanel,
|
||||
InlinePanel, MultiFieldPanel
|
||||
)
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormField
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.contrib.forms.models import AbstractEmailForm, AbstractFormField
|
||||
|
||||
|
||||
class FormField(AbstractFormField):
|
||||
|
@ -553,3 +548,59 @@ Next, you need to transform your template to display the results:
|
|||
|
||||
|
||||
You can also show the results on the landing page.
|
||||
|
||||
|
||||
Custom landing page redirect
|
||||
----------------------------
|
||||
|
||||
You can override the ``render_landing_page`` method on your `FormPage` to change what is rendered when a form submits.
|
||||
|
||||
In this example below we have added a `thank_you_page` field that enables custom redirects after a form submits to the selected page.
|
||||
|
||||
When overriding the ``render_landing_page`` method, we check if there is a linked `thank_you_page` and then redirect to it if it exists.
|
||||
|
||||
Finally, we add a URL param of `id` based on the ``form_submission`` if it exists.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from django.shortcuts import redirect
|
||||
from wagtail.wagtailadmin.edit_handlers import (
|
||||
FieldPanel, FieldRowPanel, InlinePanel, MultiFieldPanel, PageChooserPanel)
|
||||
from wagtail.contrib.forms.models import AbstractEmailForm
|
||||
|
||||
class FormPage(AbstractEmailForm):
|
||||
|
||||
# intro, thank_you_text, ...
|
||||
|
||||
thank_you_page = models.ForeignKey(
|
||||
'wagtailcore.Page',
|
||||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name='+',
|
||||
)
|
||||
|
||||
def render_landing_page(self, request, form_submission=None, *args, **kwargs):
|
||||
if self.thank_you_page:
|
||||
url = self.thank_you_page.url
|
||||
# if a form_submission instance is available, append the id to URL
|
||||
# when previewing landing page, there will not be a form_submission instance
|
||||
if form_submission:
|
||||
url += '?id=%s' % form_submission.id
|
||||
return redirect(url, permanent=False)
|
||||
# if no thank_you_page is set, render default landing page
|
||||
return super(FormPage, self).render_landing_page(request, form_submission, *args, **kwargs)
|
||||
|
||||
content_panels = AbstractEmailForm.content_panels + [
|
||||
FieldPanel('intro', classname='full'),
|
||||
InlinePanel('form_fields'),
|
||||
FieldPanel('thank_you_text', classname='full'),
|
||||
PageChooserPanel('thank_you_page'),
|
||||
MultiFieldPanel([
|
||||
FieldRowPanel([
|
||||
FieldPanel('from_address', classname='col6'),
|
||||
FieldPanel('to_address', classname='col6'),
|
||||
]),
|
||||
FieldPanel('subject'),
|
||||
], 'Email'),
|
||||
]
|
||||
|
|
|
@ -14,13 +14,13 @@ The ``wagtailforms`` module allows you to set up single-page forms, such as a 'C
|
|||
Usage
|
||||
~~~~~
|
||||
|
||||
Add ``wagtail.wagtailforms`` to your ``INSTALLED_APPS``:
|
||||
Add ``wagtail.contrib.forms`` to your ``INSTALLED_APPS``:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
INSTALLED_APPS = [
|
||||
...
|
||||
'wagtail.wagtailforms',
|
||||
'wagtail.contrib.forms',
|
||||
]
|
||||
|
||||
Within the ``models.py`` of one of your apps, create a model that extends ``wagtailforms.models.AbstractEmailForm``:
|
||||
|
@ -29,12 +29,12 @@ Within the ``models.py`` of one of your apps, create a model that extends ``wagt
|
|||
.. code-block:: python
|
||||
|
||||
from modelcluster.fields import ParentalKey
|
||||
from wagtail.wagtailadmin.edit_handlers import (
|
||||
from wagtail.admin.edit_handlers import (
|
||||
FieldPanel, FieldRowPanel,
|
||||
InlinePanel, MultiFieldPanel
|
||||
)
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormField
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.contrib.forms.models import AbstractEmailForm, AbstractFormField
|
||||
|
||||
|
||||
class FormField(AbstractFormField):
|
||||
|
@ -82,7 +82,7 @@ You now need to create two templates named ``form_page.html`` and ``form_page_la
|
|||
</body>
|
||||
</html>
|
||||
|
||||
``form_page_landing.html`` is a regular Wagtail template, displayed after the user makes a successful form submission. If you want to dynamically override the landing page template, you can do so with the ``get_landing_page_template`` method (in the same way that you would with ``get_template``).
|
||||
``form_page_landing.html`` is a regular Wagtail template, displayed after the user makes a successful form submission, `form_submission` will available in this template. If you want to dynamically override the landing page template, you can do so with the ``get_landing_page_template`` method (in the same way that you would with ``get_template``).
|
||||
|
||||
|
||||
.. _wagtailforms_formsubmissionpanel:
|
||||
|
@ -94,7 +94,7 @@ Displaying form submission information
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailforms.edit_handlers import FormSubmissionsPanel
|
||||
from wagtail.contrib.forms.edit_handlers import FormSubmissionsPanel
|
||||
|
||||
class FormPage(AbstractEmailForm):
|
||||
# ...
|
||||
|
|
|
@ -20,27 +20,27 @@ This document describes how to configure Wagtail to purge old versions of pages
|
|||
Setting it up
|
||||
-------------
|
||||
|
||||
Firstly, add ``"wagtail.contrib.wagtailfrontendcache"`` to your INSTALLED_APPS:
|
||||
Firstly, add ``"wagtail.contrib.frontend_cache"`` to your INSTALLED_APPS:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
INSTALLED_APPS = [
|
||||
...
|
||||
|
||||
"wagtail.contrib.wagtailfrontendcache"
|
||||
"wagtail.contrib.frontend_cache"
|
||||
]
|
||||
|
||||
.. versionchanged:: 0.8
|
||||
|
||||
Signal handlers are now automatically registered
|
||||
|
||||
The ``wagtailfrontendcache`` module provides a set of signal handlers which will automatically purge the cache whenever a page is published or deleted. These signal handlers are automatically registered when the ``wagtail.contrib.wagtailfrontendcache`` app is loaded.
|
||||
The ``wagtailfrontendcache`` module provides a set of signal handlers which will automatically purge the cache whenever a page is published or deleted. These signal handlers are automatically registered when the ``wagtail.contrib.frontend_cache`` app is loaded.
|
||||
|
||||
|
||||
Varnish/Squid
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
Add a new item into the ``WAGTAILFRONTENDCACHE`` setting and set the ``BACKEND`` parameter to ``wagtail.contrib.wagtailfrontendcache.backends.HTTPBackend``. This backend requires an extra parameter ``LOCATION`` which points to where the cache is running (this must be a direct connection to the server and cannot go through another proxy).
|
||||
Add a new item into the ``WAGTAILFRONTENDCACHE`` setting and set the ``BACKEND`` parameter to ``wagtail.contrib.frontend_cache.backends.HTTPBackend``. This backend requires an extra parameter ``LOCATION`` which points to where the cache is running (this must be a direct connection to the server and cannot go through another proxy).
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
@ -48,7 +48,7 @@ Add a new item into the ``WAGTAILFRONTENDCACHE`` setting and set the ``BACKEND``
|
|||
|
||||
WAGTAILFRONTENDCACHE = {
|
||||
'varnish': {
|
||||
'BACKEND': 'wagtail.contrib.wagtailfrontendcache.backends.HTTPBackend',
|
||||
'BACKEND': 'wagtail.contrib.frontend_cache.backends.HTTPBackend',
|
||||
'LOCATION': 'http://localhost:8000',
|
||||
},
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ Cloudflare
|
|||
|
||||
Firstly, you need to register an account with Cloudflare if you haven't already got one. You can do this here: `Cloudflare Sign up <https://www.cloudflare.com/sign-up>`_
|
||||
|
||||
Add an item into the ``WAGTAILFRONTENDCACHE`` and set the ``BACKEND`` parameter to ``wagtail.contrib.wagtailfrontendcache.backends.CloudflareBackend``. This backend requires three extra parameters, ``EMAIL`` (your Cloudflare account email), ``TOKEN`` (your API token from Cloudflare), and ``ZONEID`` (for zone id for your domain, see below).
|
||||
Add an item into the ``WAGTAILFRONTENDCACHE`` and set the ``BACKEND`` parameter to ``wagtail.contrib.frontend_cache.backends.CloudflareBackend``. This backend requires three extra parameters, ``EMAIL`` (your Cloudflare account email), ``TOKEN`` (your API token from Cloudflare), and ``ZONEID`` (for zone id for your domain, see below).
|
||||
|
||||
To find the ``ZONEID`` for your domain, read the `Cloudflare API Documentation <https://api.cloudflare.com/#getting-started-resource-ids>`_
|
||||
|
||||
|
@ -78,7 +78,7 @@ To find the ``ZONEID`` for your domain, read the `Cloudflare API Documentation <
|
|||
|
||||
WAGTAILFRONTENDCACHE = {
|
||||
'cloudflare': {
|
||||
'BACKEND': 'wagtail.contrib.wagtailfrontendcache.backends.CloudflareBackend',
|
||||
'BACKEND': 'wagtail.contrib.frontend_cache.backends.CloudflareBackend',
|
||||
'EMAIL': 'your-cloudflare-email-address@example.com',
|
||||
'TOKEN': 'your cloudflare api token',
|
||||
'ZONEID': 'your cloudflare domain zone id',
|
||||
|
@ -92,13 +92,13 @@ Amazon CloudFront
|
|||
|
||||
Within Amazon Web Services you will need at least one CloudFront web distribution. If you don't have one, you can get one here: `CloudFront getting started <https://aws.amazon.com/cloudfront/>`_
|
||||
|
||||
Add an item into the ``WAGTAILFRONTENDCACHE`` and set the ``BACKEND`` parameter to ``wagtail.contrib.wagtailfrontendcache.backends.CloudfrontBackend``. This backend requires one extra parameter, ``DISTRIBUTION_ID`` (your CloudFront generated distribution id).
|
||||
Add an item into the ``WAGTAILFRONTENDCACHE`` and set the ``BACKEND`` parameter to ``wagtail.contrib.frontend_cache.backends.CloudfrontBackend``. This backend requires one extra parameter, ``DISTRIBUTION_ID`` (your CloudFront generated distribution id).
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
WAGTAILFRONTENDCACHE = {
|
||||
'cloudfront': {
|
||||
'BACKEND': 'wagtail.contrib.wagtailfrontendcache.backends.CloudfrontBackend',
|
||||
'BACKEND': 'wagtail.contrib.frontend_cache.backends.CloudfrontBackend',
|
||||
'DISTRIBUTION_ID': 'your-distribution-id',
|
||||
},
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ In case you run multiple sites with Wagtail and each site has its CloudFront dis
|
|||
|
||||
WAGTAILFRONTENDCACHE = {
|
||||
'cloudfront': {
|
||||
'BACKEND': 'wagtail.contrib.wagtailfrontendcache.backends.CloudfrontBackend',
|
||||
'BACKEND': 'wagtail.contrib.frontend_cache.backends.CloudfrontBackend',
|
||||
'DISTRIBUTION_ID': {
|
||||
'www.wagtail.io': 'your-distribution-id',
|
||||
'www.madewithwagtail.org': 'your-distribution-id',
|
||||
|
@ -164,8 +164,8 @@ 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.contrib.wagtailfrontendcache.utils import PurgeBatch
|
||||
from wagtail.core.signals import page_published
|
||||
from wagtail.contrib.frontend_cache.utils import PurgeBatch
|
||||
|
||||
...
|
||||
|
||||
|
@ -202,7 +202,7 @@ For example, this could be useful for purging a single page on a blog index:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.contrib.wagtailfrontendcache.utils import PurgeBatch
|
||||
from wagtail.contrib.frontend_cache.utils import PurgeBatch
|
||||
|
||||
# Purge the first page of the blog index
|
||||
batch = PurgeBatch()
|
||||
|
@ -217,7 +217,7 @@ The ``PurgeBatch`` class
|
|||
|
||||
All of the methods available on ``PurgeBatch`` are listed below:
|
||||
|
||||
.. automodule:: wagtail.contrib.wagtailfrontendcache.utils
|
||||
.. automodule:: wagtail.contrib.frontend_cache.utils
|
||||
.. autoclass:: PurgeBatch
|
||||
|
||||
.. automethod:: add_url
|
||||
|
|
|
@ -32,12 +32,12 @@ or attribute on the instance that you'd like ``InpectView`` to render.
|
|||
|
||||
A sensible value will be rendered for most field types.
|
||||
|
||||
If you have ``wagtail.wagtailimages`` installed, and the value happens to be an
|
||||
If you have ``wagtail.images`` installed, and the value happens to be an
|
||||
instance of ``wagtailimages.models.Image`` (or a custom model that subclasses
|
||||
``wagtailimages.models.AbstractImage``), a thumbnail of that image will be
|
||||
rendered.
|
||||
|
||||
If you have `wagtail.wagtaildocs` installed, and the value happens to be an
|
||||
If you have `wagtail.documents` installed, and the value happens to be an
|
||||
instance of `wagtaildocs.models.Document` (or a custom model that subclasses
|
||||
``wagtaildocs.models.AbstractDocument``), a link to that document will be
|
||||
rendered, along with the document title, file extension and size.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
``RoutablePageMixin``
|
||||
=====================
|
||||
|
||||
.. module:: wagtail.contrib.wagtailroutablepage
|
||||
.. module:: wagtail.contrib.routable_page
|
||||
|
||||
The ``RoutablePageMixin`` mixin provides a convenient way for a page to respond on multiple sub-URLs with different views. For example, a blog section on a site might provide several different types of index page at URLs like ``/blog/2013/06/``, ``/blog/authors/bob/``, ``/blog/tagged/python/``, all served by the same page instance.
|
||||
|
||||
|
@ -16,28 +16,28 @@ By default a route for ``r'^$'`` exists, which serves the content exactly like a
|
|||
Installation
|
||||
============
|
||||
|
||||
Add ``"wagtail.contrib.wagtailroutablepage"`` to your INSTALLED_APPS:
|
||||
Add ``"wagtail.contrib.routable_page"`` to your INSTALLED_APPS:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
INSTALLED_APPS = [
|
||||
...
|
||||
|
||||
"wagtail.contrib.wagtailroutablepage",
|
||||
"wagtail.contrib.routable_page",
|
||||
]
|
||||
|
||||
|
||||
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.routable_page.models.RoutablePageMixin` and :class:`wagtail.core.models.Page`, then define some view methods and decorate them with ``wagtail.contrib.routable_page.models.route``.
|
||||
|
||||
Here's an example of an ``EventPage`` with three views:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.contrib.wagtailroutablepage.models import RoutablePageMixin, route
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.contrib.routable_page.models import RoutablePageMixin, route
|
||||
|
||||
|
||||
class EventPage(RoutablePageMixin, Page):
|
||||
|
@ -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,8 +94,8 @@ 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.contrib.wagtailroutablepage.models import RoutablePageMixin, route
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.contrib.routable_page.models import RoutablePageMixin, route
|
||||
|
||||
|
||||
class EventPage(RoutablePageMixin, Page):
|
||||
|
@ -116,7 +116,7 @@ The route name defaults to the name of the view. You can override this name with
|
|||
The ``RoutablePageMixin`` class
|
||||
===============================
|
||||
|
||||
.. automodule:: wagtail.contrib.wagtailroutablepage.models
|
||||
.. automodule:: wagtail.contrib.routable_page.models
|
||||
.. autoclass:: RoutablePageMixin
|
||||
|
||||
.. automethod:: get_subpage_urls
|
||||
|
@ -144,7 +144,7 @@ The ``RoutablePageMixin`` class
|
|||
The ``routablepageurl`` template tag
|
||||
====================================
|
||||
|
||||
.. currentmodule:: wagtail.contrib.wagtailroutablepage.templatetags.wagtailroutablepage_tags
|
||||
.. currentmodule:: wagtail.contrib.routable_page.templatetags.wagtailroutablepage_tags
|
||||
.. autofunction:: routablepageurl
|
||||
|
||||
Example:
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
Promoted search results
|
||||
=======================
|
||||
|
||||
.. module:: wagtail.contrib.wagtailsearchpromotions
|
||||
.. module:: wagtail.contrib.search_promotions
|
||||
|
||||
.. versionchanged:: 1.1
|
||||
|
||||
Before Wagtail 1.1, promoted search results were implemented in the :mod:`wagtail.wagtailsearch` core module and called "editors picks".
|
||||
Before Wagtail 1.1, promoted search results were implemented in the :mod:`wagtail.search` core module and called "editors picks".
|
||||
|
||||
The ``searchpromotions`` module provides the models and user interface for managing "Promoted search results" and displaying them in a search results page.
|
||||
|
||||
|
@ -18,7 +18,7 @@ The ``searchpromotions`` module provides the models and user interface for manag
|
|||
Installation
|
||||
============
|
||||
|
||||
The ``searchpromotions`` module is not enabled by default. To install it, add ``wagtail.contrib.wagtailsearchpromotions`` to ``INSTALLED_APPS`` in your project's Django settings file.
|
||||
The ``searchpromotions`` module is not enabled by default. To install it, add ``wagtail.contrib.search_promotions`` to ``INSTALLED_APPS`` in your project's Django settings file.
|
||||
|
||||
|
||||
.. code-block:: python
|
||||
|
@ -26,7 +26,7 @@ The ``searchpromotions`` module is not enabled by default. To install it, add ``
|
|||
INSTALLED_APPS = [
|
||||
...
|
||||
|
||||
'wagtail.contrib.wagtailsearchpromotions',
|
||||
'wagtail.contrib.search_promotions',
|
||||
]
|
||||
|
||||
This app contains migrations so make sure you run the ``migrate`` django-admin command after installing.
|
||||
|
|
|
@ -64,7 +64,7 @@ with a custom ``edit_handler`` attribute:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailadmin.edit_handlers import TabbedInterface, ObjectList
|
||||
from wagtail.admin.edit_handlers import TabbedInterface, ObjectList
|
||||
|
||||
@register_setting
|
||||
class MySettings(BaseSetting):
|
||||
|
|
|
@ -4,7 +4,7 @@ Sitemap generator
|
|||
=================
|
||||
|
||||
This document describes how to create XML sitemaps for your Wagtail website
|
||||
using the ``wagtail.contrib.wagtailsitemaps`` module.
|
||||
using the ``wagtail.contrib.sitemaps`` module.
|
||||
|
||||
|
||||
.. note::
|
||||
|
@ -12,9 +12,9 @@ using the ``wagtail.contrib.wagtailsitemaps`` module.
|
|||
As of Wagtail 1.10 the Django contrib sitemap app is used to generate
|
||||
sitemaps. However since Wagtail requires the Site instance to be available
|
||||
during the sitemap generation you will have to use the views from the
|
||||
``wagtail.contrib.wagtailsitemaps.views`` module instead of the views
|
||||
provided by Django (``django.contrib.sitemaps.views``).
|
||||
|
||||
``wagtail.contrib.sitemaps.views`` module instead of the views
|
||||
provided by Django (``django.contrib.sitemaps.views``).
|
||||
|
||||
The usage of these views is otherwise identical, which means that
|
||||
customisation and caching of the sitemaps are done using the default Django
|
||||
patterns. See the Django documentation for in-depth information.
|
||||
|
@ -37,12 +37,12 @@ Django settings file:
|
|||
|
||||
|
||||
Then, in ``urls.py``, you need to add a link to the
|
||||
``wagtail.contrib.wagtailsitemaps.views.sitemap`` view which generates the
|
||||
``wagtail.contrib.sitemaps.views.sitemap`` view which generates the
|
||||
sitemap:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.contrib.wagtailsitemaps.views import sitemap
|
||||
from wagtail.contrib.sitemaps.views import sitemap
|
||||
|
||||
urlpatterns = [
|
||||
...
|
||||
|
|
|
@ -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,9 +62,9 @@ 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):
|
||||
class WelcomePanel:
|
||||
order = 50
|
||||
|
||||
def render(self):
|
||||
|
@ -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):
|
||||
|
@ -126,7 +126,7 @@ Hooks for building new areas of the admin interface (alongside pages, images, do
|
|||
``register_admin_menu_item``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Add an item to the Wagtail admin menu. The callable passed to this hook must return an instance of ``wagtail.wagtailadmin.menu.MenuItem``. New items can be constructed from the ``MenuItem`` class by passing in a ``label`` which will be the text in the menu item, and the URL of the admin page you want the menu item to link to (usually by calling ``reverse()`` on the admin view you've set up). Additionally, the following keyword arguments are accepted:
|
||||
Add an item to the Wagtail admin menu. The callable passed to this hook must return an instance of ``wagtail.admin.menu.MenuItem``. New items can be constructed from the ``MenuItem`` class by passing in a ``label`` which will be the text in the menu item, and the URL of the admin page you want the menu item to link to (usually by calling ``reverse()`` on the admin view you've set up). Additionally, the following keyword arguments are accepted:
|
||||
|
||||
:name: an internal name used to identify the menu item; defaults to the slugified form of the label.
|
||||
:classnames: additional classnames applied to the link, used to give it an icon
|
||||
|
@ -139,8 +139,8 @@ 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.wagtailadmin.menu import MenuItem
|
||||
from wagtail.core import hooks
|
||||
from wagtail.admin.menu import MenuItem
|
||||
|
||||
@hooks.register('register_admin_menu_item')
|
||||
def register_frank_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(
|
||||
|
@ -196,7 +196,7 @@ Hooks for building new areas of the admin interface (alongside pages, images, do
|
|||
``register_admin_search_area``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Add an item to the Wagtail admin search "Other Searches". Behaviour of this hook is similar to ``register_admin_menu_item``. The callable passed to this hook must return an instance of ``wagtail.wagtailadmin.search.SearchArea``. New items can be constructed from the ``SearchArea`` class by passing the following parameters:
|
||||
Add an item to the Wagtail admin search "Other Searches". Behaviour of this hook is similar to ``register_admin_menu_item``. The callable passed to this hook must return an instance of ``wagtail.admin.search.SearchArea``. New items can be constructed from the ``SearchArea`` class by passing the following parameters:
|
||||
|
||||
:label: text displayed in the "Other Searches" option box.
|
||||
:name: an internal name used to identify the search option; defaults to the slugified form of the label.
|
||||
|
@ -215,8 +215,8 @@ 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.wagtailadmin.search import SearchArea
|
||||
from wagtail.core import hooks
|
||||
from wagtail.admin.search import SearchArea
|
||||
|
||||
@hooks.register('register_admin_search_area')
|
||||
def register_frank_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,9 +501,9 @@ 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):
|
||||
class UserbarPuppyLinkItem:
|
||||
def render(self, request):
|
||||
return '<li><a href="http://cuteoverload.com/tag/puppehs/" ' \
|
||||
+ 'target="_parent" class="action icon icon-wagtail">Puppies!</a></li>'
|
||||
|
@ -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):
|
||||
|
@ -691,7 +691,7 @@ Page explorer
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailadmin import widgets as wagtailadmin_widgets
|
||||
from wagtail.admin import widgets as wagtailadmin_widgets
|
||||
|
||||
@hooks.register('register_page_listing_buttons')
|
||||
def page_listing_buttons(page, page_perms, is_parent=False):
|
||||
|
@ -715,7 +715,7 @@ Page explorer
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailadmin import widgets as wagtailadmin_widgets
|
||||
from wagtail.admin import widgets as wagtailadmin_widgets
|
||||
|
||||
@hooks.register('register_page_listing_more_buttons')
|
||||
def page_listing_more_buttons(page, page_perms, is_parent=False):
|
||||
|
@ -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,19 +34,19 @@ 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::
|
||||
|
||||
A much simpler way of adding more endpoints to pages is provided by the :mod:`~wagtail.contrib.wagtailroutablepage` module.
|
||||
A much simpler way of adding more endpoints to pages is provided by the :mod:`~wagtail.contrib.routable_page` module.
|
||||
|
||||
Wagtail routes requests by iterating over the path components (separated with a forward slash ``/``), finding matching objects based on their slug, and delegating further routing to that object's model class. The Wagtail source is very instructive in figuring out what's happening. This is the default ``route()`` method of the ``Page`` class:
|
||||
|
||||
|
@ -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
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -210,7 +210,7 @@ In addition to the model fields provided, ``Page`` has many properties and metho
|
|||
|
||||
The form class used as a base for editing Pages of this type in the Wagtail page editor.
|
||||
This attribute can be set on a model to customise the Page editor form.
|
||||
Forms must be a subclass of :class:`~wagtail.wagtailadmin.forms.WagtailAdminPageForm`.
|
||||
Forms must be a subclass of :class:`~wagtail.admin.forms.WagtailAdminPageForm`.
|
||||
See :ref:`custom_edit_handler_forms` for more information.
|
||||
|
||||
.. _site-model-ref:
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Available panel types
|
||||
=====================
|
||||
|
||||
.. module:: wagtail.wagtailadmin.edit_handlers
|
||||
.. module:: wagtail.admin.edit_handlers
|
||||
|
||||
FieldPanel
|
||||
----------
|
||||
|
@ -35,7 +35,7 @@ MultiFieldPanel
|
|||
|
||||
.. class:: MultiFieldPanel(children, heading="", classname=None)
|
||||
|
||||
This panel condenses several :class:`~wagtail.wagtailadmin.edit_handlers.FieldPanel` s or choosers, from a ``list`` or ``tuple``, under a single ``heading`` string.
|
||||
This panel condenses several :class:`~wagtail.admin.edit_handlers.FieldPanel` s or choosers, from a ``list`` or ``tuple``, under a single ``heading`` string.
|
||||
|
||||
.. attribute:: MultiFieldPanel.children
|
||||
|
||||
|
@ -96,12 +96,12 @@ 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.wagtailadmin.edit_handlers import PageChooserPanel
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.admin.edit_handlers import PageChooserPanel
|
||||
|
||||
|
||||
class BookPage(Page):
|
||||
|
@ -129,16 +129,16 @@ PageChooserPanel
|
|||
ImageChooserPanel
|
||||
-----------------
|
||||
|
||||
.. module:: wagtail.wagtailimages.edit_handlers
|
||||
.. module:: wagtail.images.edit_handlers
|
||||
|
||||
.. class:: ImageChooserPanel(field_name)
|
||||
|
||||
Wagtail includes a unified image library, which you can access in your models through the :class:`~wagtail.wagtailimages.models.Image` model and the ``ImageChooserPanel`` chooser. Here's how:
|
||||
Wagtail includes a unified image library, which you can access in your models through the :class:`~wagtail.images.models.Image` model and the ``ImageChooserPanel`` chooser. Here's how:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailimages.models import Image
|
||||
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
|
||||
from wagtail.images.models import Image
|
||||
from wagtail.images.edit_handlers import ImageChooserPanel
|
||||
|
||||
|
||||
class BookPage(Page):
|
||||
|
@ -163,17 +163,17 @@ ImageChooserPanel
|
|||
FormSubmissionsPanel
|
||||
--------------------
|
||||
|
||||
.. module:: wagtail.wagtailforms.edit_handlers
|
||||
.. module:: wagtail.contrib.forms.edit_handlers
|
||||
|
||||
.. class:: FormSubmissionsPanel
|
||||
|
||||
This panel adds a single, read-only section in the edit interface for pages implementing the :class:`~wagtail.wagtailforms.models.AbstractForm` model.
|
||||
This panel adds a single, read-only section in the edit interface for pages implementing the :class:`~wagtail.contrib.forms.models.AbstractForm` model.
|
||||
It includes the number of total submissions for the given form and also a link to the listing of submissions.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailforms.models import AbstractForm
|
||||
from wagtail.wagtailforms.edit_handlers import FormSubmissionsPanel
|
||||
from wagtail.contrib.forms.models import AbstractForm
|
||||
from wagtail.contrib.forms.edit_handlers import FormSubmissionsPanel
|
||||
|
||||
class ContactFormPage(AbstractForm):
|
||||
content_panels = [
|
||||
|
@ -183,16 +183,16 @@ FormSubmissionsPanel
|
|||
DocumentChooserPanel
|
||||
--------------------
|
||||
|
||||
.. module:: wagtail.wagtaildocs.edit_handlers
|
||||
.. module:: wagtail.documents.edit_handlers
|
||||
|
||||
.. class:: DocumentChooserPanel(field_name)
|
||||
|
||||
For files in other formats, Wagtail provides a generic file store through the :class:`~wagtail.wagtaildocs.models.Document` model:
|
||||
For files in other formats, Wagtail provides a generic file store through the :class:`~wagtail.documents.models.Document` model:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtaildocs.models import Document
|
||||
from wagtail.wagtaildocs.edit_handlers import DocumentChooserPanel
|
||||
from wagtail.documents.models import Document
|
||||
from wagtail.documents.edit_handlers import DocumentChooserPanel
|
||||
|
||||
|
||||
class BookPage(Page):
|
||||
|
@ -217,7 +217,7 @@ SnippetChooserPanel
|
|||
|
||||
Before Wagtail 1.1, it was necessary to pass the snippet model class as a second parameter to ``SnippetChooserPanel``. This is now automatically picked up from the field.
|
||||
|
||||
.. module:: wagtail.wagtailsnippets.edit_handlers
|
||||
.. module:: wagtail.snippets.edit_handlers
|
||||
|
||||
.. class:: SnippetChooserPanel(field_name, snippet_type=None)
|
||||
|
||||
|
@ -225,7 +225,7 @@ SnippetChooserPanel
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailsnippets.edit_handlers import SnippetChooserPanel
|
||||
from wagtail.snippets.edit_handlers import SnippetChooserPanel
|
||||
|
||||
class BookPage(Page):
|
||||
advert = models.ForeignKey(
|
||||
|
@ -246,7 +246,7 @@ SnippetChooserPanel
|
|||
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.wagtailadmin.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.edit_handlers.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.
|
||||
|
||||
|
@ -262,7 +262,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.wagtailadmin.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.edit_handlers.MultiFieldPanel`, which places its child fields into a formset.
|
||||
|
||||
|
||||
Titles
|
||||
|
@ -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
|
||||
|
@ -327,7 +327,7 @@ Let's look at the example of adding related links to a :class:`~wagtail.wagtailc
|
|||
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.wagtailadmin.edit_handlers.InlinePanel` to provide an interface for it all. Let's look again at the parameters that :class:`~wagtail.wagtailadmin.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.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:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
@ -337,7 +337,7 @@ The ``relation_name`` is the ``related_name`` label given to the cluster's ``Par
|
|||
|
||||
.. versionchanged:: 1.0
|
||||
|
||||
In previous versions, it was necessary to pass the base model as the first parameter to :class:`~wagtail.wagtailadmin.edit_handlers.InlinePanel`; this is no longer required.
|
||||
In previous versions, it was necessary to pass the base model as the first parameter to :class:`~wagtail.admin.edit_handlers.InlinePanel`; this is no longer required.
|
||||
|
||||
For another example of using model clusters, see :ref:`tagging`
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -10,6 +10,12 @@ Wagtail 2.0 release notes - IN DEVELOPMENT
|
|||
What's new
|
||||
==========
|
||||
|
||||
Reorganised modules
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The modules that make up Wagtail have been renamed and reorganised, to avoid the repetition in names like ``wagtail.wagtailcore.models`` (originally an artefact of app naming limitations in Django 1.6) and to improve consistency. While this will require some up-front work to upgrade existing Wagtail sites, we believe that this will be a long-term improvement to the developer experience, improving readability of code and reducing errors. This change was implemented by Karl Hobley and Matt Westcott.
|
||||
|
||||
|
||||
Other features
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -27,6 +33,7 @@ Other features
|
|||
* Added ``exclude_fields_in_copy`` property to Page to define fields that should not be included on page copy (LB (Ben Johnston))
|
||||
* Improved error message on incorrect ``{% image %}`` tag syntax (LB (Ben Johnston))
|
||||
* Optimized preview data storage (Bertrand Bordage)
|
||||
* Added `render_landing_page` method to `AbstractForm` to be easily overridden and pass `form_submission` to landing page context (Stein Strindhaug)
|
||||
|
||||
Bug fixes
|
||||
~~~~~~~~~
|
||||
|
@ -52,6 +59,63 @@ Removed support for Python 2.7, Django 1.8 and Django 1.10
|
|||
|
||||
Python 2.7, Django 1.8 and Django 1.10 are no longer supported in this release. You are advised to upgrade your project to Python 3 and Django 1.11 before upgrading to Wagtail 2.0.
|
||||
|
||||
|
||||
Wagtail module path updates
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Many of the module paths within Wagtail have been reorganised:
|
||||
|
||||
+-----------------------------------------+-----------------------------------+-----------------------------------+
|
||||
| Old name | New name | Notes |
|
||||
+=========================================+===================================+===================================+
|
||||
| wagtail.wagtailcore | wagtail.core | |
|
||||
+-----------------------------------------+-----------------------------------+-----------------------------------+
|
||||
| wagtail.wagtailadmin | wagtail.admin | |
|
||||
+-----------------------------------------+-----------------------------------+-----------------------------------+
|
||||
| wagtail.wagtaildocs | wagtail.documents | 'documents' no longer abbreviated |
|
||||
+-----------------------------------------+-----------------------------------+-----------------------------------+
|
||||
| wagtail.wagtailembeds | wagtail.embeds | |
|
||||
+-----------------------------------------+-----------------------------------+-----------------------------------+
|
||||
| wagtail.wagtailimages | wagtail.images | |
|
||||
+-----------------------------------------+-----------------------------------+-----------------------------------+
|
||||
| wagtail.wagtailsearch | wagtail.search | |
|
||||
+-----------------------------------------+-----------------------------------+-----------------------------------+
|
||||
| wagtail.wagtailsites | wagtail.sites | |
|
||||
+-----------------------------------------+-----------------------------------+-----------------------------------+
|
||||
| wagtail.wagtailsnippets | wagtail.snippets | |
|
||||
+-----------------------------------------+-----------------------------------+-----------------------------------+
|
||||
| wagtail.wagtailusers | wagtail.users | |
|
||||
+-----------------------------------------+-----------------------------------+-----------------------------------+
|
||||
| wagtail.wagtailforms | wagtail.contrib.forms | Moved into 'contrib' |
|
||||
+-----------------------------------------+-----------------------------------+-----------------------------------+
|
||||
| wagtail.wagtailredirects | wagtail.contrib.redirects | Moved into 'contrib' |
|
||||
+-----------------------------------------+-----------------------------------+-----------------------------------+
|
||||
| wagtail.contrib.wagtailapi | *removed* | API v1, removed in this release |
|
||||
+-----------------------------------------+-----------------------------------+-----------------------------------+
|
||||
| wagtail.contrib.wagtailfrontendcache | wagtail.contrib.frontend_cache | Underscore added |
|
||||
+-----------------------------------------+-----------------------------------+-----------------------------------+
|
||||
| wagtail.contrib.wagtailroutablepage | wagtail.contrib.routable_page | Underscore added |
|
||||
+-----------------------------------------+-----------------------------------+-----------------------------------+
|
||||
| wagtail.contrib.wagtailsearchpromotions | wagtail.contrib.search_promotions | Underscore added |
|
||||
+-----------------------------------------+-----------------------------------+-----------------------------------+
|
||||
| wagtail.contrib.wagtailsitemaps | wagtail.contrib.sitemaps | |
|
||||
+-----------------------------------------+-----------------------------------+-----------------------------------+
|
||||
| wagtail.contrib.wagtailstyleguide | wagtail.contrib.styleguide | |
|
||||
+-----------------------------------------+-----------------------------------+-----------------------------------+
|
||||
|
||||
References to these module paths within your Wagtail project need to be updated when you upgrade to Wagtail 2.0. This includes:
|
||||
|
||||
* ``import`` lines
|
||||
* Paths specified in settings, such as ``INSTALLED_APPS``, ``MIDDLEWARE`` and ``WAGTAILSEARCH_BACKENDS``
|
||||
* Fields and blocks referenced within migrations, such as ``wagtail.wagtailcore.fields.StreamField`` and ``wagtail.wagtailcore.blocks.RichTextBlock``
|
||||
|
||||
However, app names that are *not* part of a dotted module path should be left unchanged - in this case, the ``wagtail`` prefix is still required to distinguish them from other apps that might exist in the project with names such as ``admin`` or ``images``. The following should be left unchanged:
|
||||
|
||||
* App labels used in database table names, content types or permissions
|
||||
* Paths to templates and static files, e.g. when :ref:`overriding admin templates with custom branding <custom_branding>`
|
||||
* Template tag library names, e.g. ``{% load wagtailcore_tags %}``
|
||||
|
||||
|
||||
Removed support for Elasticsearch 1.x
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ done from the Django shell:
|
|||
.. code-block:: python
|
||||
|
||||
# Replace this with your custom rendition model if you use one
|
||||
>>> from wagtail.wagtailimages.models import Rendition
|
||||
>>> from wagtail.images.models import Rendition
|
||||
>>> Rendition.objects.all().delete()
|
||||
|
||||
Changing per-tag
|
||||
|
|
|
@ -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,11 +26,11 @@ 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.wagtailadmin.edit_handlers import FieldPanel, MultiFieldPanel, InlinePanel
|
||||
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
|
||||
from wagtail.wagtailsearch import index
|
||||
from wagtail.core.models import Page, Orderable
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.admin.edit_handlers import FieldPanel, MultiFieldPanel, InlinePanel
|
||||
from wagtail.images.edit_handlers import ImageChooserPanel
|
||||
from wagtail.search import index
|
||||
|
||||
|
||||
class BlogPage(Page):
|
||||
|
@ -143,25 +143,25 @@ Here's a summary of the ``EditHandler`` classes that Wagtail provides out of the
|
|||
|
||||
These allow editing of model fields. The ``FieldPanel`` class will choose the correct widget based on the type of the field, though ``StreamField`` fields need to use a specialised panel class.
|
||||
|
||||
- :class:`~wagtail.wagtailadmin.edit_handlers.FieldPanel`
|
||||
- :class:`~wagtail.wagtailadmin.edit_handlers.StreamFieldPanel`
|
||||
- :class:`~wagtail.admin.edit_handlers.FieldPanel`
|
||||
- :class:`~wagtail.admin.edit_handlers.StreamFieldPanel`
|
||||
|
||||
**Structural**
|
||||
|
||||
These are used for structuring fields in the interface.
|
||||
|
||||
- :class:`~wagtail.wagtailadmin.edit_handlers.MultiFieldPanel` - For grouping similar fields together
|
||||
- :class:`~wagtail.wagtailadmin.edit_handlers.InlinePanel` - For inlining child models
|
||||
- :class:`~wagtail.wagtailadmin.edit_handlers.FieldRowPanel` - For organising multiple fields into a single row
|
||||
- :class:`~wagtail.admin.edit_handlers.MultiFieldPanel` - For grouping similar fields together
|
||||
- :class:`~wagtail.admin.edit_handlers.InlinePanel` - For inlining child models
|
||||
- :class:`~wagtail.admin.edit_handlers.FieldRowPanel` - For organising multiple fields into a single row
|
||||
|
||||
**Chooser**
|
||||
|
||||
``ForeignKey`` fields to certain models can use one of the below ``ChooserPanel`` classes. These add a nice modal chooser interface, and the image/document choosers also allow uploading new files without leaving the page editor.
|
||||
|
||||
- :class:`~wagtail.wagtailadmin.edit_handlers.PageChooserPanel`
|
||||
- :class:`~wagtail.wagtailimages.edit_handlers.ImageChooserPanel`
|
||||
- :class:`~wagtail.wagtaildocs.edit_handlers.DocumentChooserPanel`
|
||||
- :class:`~wagtail.wagtailsnippets.edit_handlers.SnippetChooserPanel`
|
||||
- :class:`~wagtail.admin.edit_handlers.PageChooserPanel`
|
||||
- :class:`~wagtail.images.edit_handlers.ImageChooserPanel`
|
||||
- :class:`~wagtail.documents.edit_handlers.DocumentChooserPanel`
|
||||
- :class:`~wagtail.snippets.edit_handlers.SnippetChooserPanel`
|
||||
|
||||
.. note::
|
||||
|
||||
|
@ -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):
|
||||
|
@ -393,7 +393,7 @@ For example, the following inline model can be used to add related links (a list
|
|||
FieldPanel('url'),
|
||||
]
|
||||
|
||||
To add this to the admin interface, use the :class:`~wagtail.wagtailadmin.edit_handlers.InlinePanel` edit panel class:
|
||||
To add this to the admin interface, use the :class:`~wagtail.admin.edit_handlers.InlinePanel` edit panel class:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
@ -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):
|
||||
|
|
|
@ -13,7 +13,7 @@ You can configure which backend to use with the ``WAGTAILSEARCH_BACKENDS`` setti
|
|||
|
||||
WAGTAILSEARCH_BACKENDS = {
|
||||
'default': {
|
||||
'BACKEND': 'wagtail.wagtailsearch.backends.db',
|
||||
'BACKEND': 'wagtail.search.backends.db',
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ Here's a list of backends that Wagtail supports out of the box.
|
|||
Database Backend (default)
|
||||
--------------------------
|
||||
|
||||
``wagtail.wagtailsearch.backends.db``
|
||||
``wagtail.search.backends.db``
|
||||
|
||||
The database backend is very basic and is intended only to be used in development and on small sites. It cannot order results by relevance, severely hampering its usefulness when searching a large collection of pages.
|
||||
|
||||
|
@ -99,9 +99,9 @@ Elasticsearch Backend
|
|||
|
||||
Elasticsearch versions 2 and 5 are supported. Use the appropriate backend for your version:
|
||||
|
||||
``wagtail.wagtailsearch.backends.elasticsearch2`` (Elasticsearch 2.x)
|
||||
``wagtail.search.backends.elasticsearch2`` (Elasticsearch 2.x)
|
||||
|
||||
``wagtail.wagtailsearch.backends.elasticsearch5`` (Elasticsearch 5.x)
|
||||
``wagtail.search.backends.elasticsearch5`` (Elasticsearch 5.x)
|
||||
|
||||
Prerequisites are the `Elasticsearch`_ service itself and, via pip, the `elasticsearch-py`_ package. The major version of the package must match the installed version of Elasticsearch:
|
||||
|
||||
|
@ -121,7 +121,7 @@ The backend is configured in settings:
|
|||
|
||||
WAGTAILSEARCH_BACKENDS = {
|
||||
'default': {
|
||||
'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch2',
|
||||
'BACKEND': 'wagtail.search.backends.elasticsearch2',
|
||||
'URLS': ['http://localhost:9200'],
|
||||
'INDEX': 'wagtail',
|
||||
'TIMEOUT': 5,
|
||||
|
@ -177,7 +177,7 @@ The Elasticsearch backend is compatible with `Amazon Elasticsearch Service`_, bu
|
|||
|
||||
WAGTAILSEARCH_BACKENDS = {
|
||||
'default': {
|
||||
'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch2',
|
||||
'BACKEND': 'wagtail.search.backends.elasticsearch2',
|
||||
'INDEX': 'wagtail',
|
||||
'TIMEOUT': 5,
|
||||
'HOSTS': [{
|
||||
|
|
|
@ -28,7 +28,7 @@ Signal handlers
|
|||
|
||||
Signal handlers are now automatically registered
|
||||
|
||||
``wagtailsearch`` provides some signal handlers which bind to the save/delete signals of all indexed models. This would automatically add and delete them from all backends you have registered in ``WAGTAILSEARCH_BACKENDS``. These signal handlers are automatically registered when the ``wagtail.wagtailsearch`` app is loaded.
|
||||
``wagtailsearch`` provides some signal handlers which bind to the save/delete signals of all indexed models. This would automatically add and delete them from all backends you have registered in ``WAGTAILSEARCH_BACKENDS``. These signal handlers are automatically registered when the ``wagtail.search`` app is loaded.
|
||||
|
||||
|
||||
The ``update_index`` command
|
||||
|
@ -67,7 +67,7 @@ This creates an ``EventPage`` model with two fields: ``description`` and ``date`
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailsearch import index
|
||||
from wagtail.search import index
|
||||
from django.utils import timezone
|
||||
|
||||
class EventPage(Page):
|
||||
|
@ -170,7 +170,7 @@ One use for this is indexing the ``get_*_display`` methods Django creates automa
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailsearch import index
|
||||
from wagtail.search import index
|
||||
|
||||
class EventPage(Page):
|
||||
IS_PRIVATE_CHOICES = (
|
||||
|
@ -214,7 +214,7 @@ To do this, inherit from ``index.Indexed`` and add some ``search_fields`` to the
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailsearch import index
|
||||
from wagtail.search import index
|
||||
|
||||
class Book(index.Indexed, models.Model):
|
||||
title = models.CharField(max_length=255)
|
||||
|
@ -232,7 +232,7 @@ To do this, inherit from ``index.Indexed`` and add some ``search_fields`` to the
|
|||
]
|
||||
|
||||
# As this model doesn't have a search method in its QuerySet, we have to call search directly on the backend
|
||||
>>> from wagtail.wagtailsearch.backends import get_search_backend
|
||||
>>> from wagtail.search.backends import get_search_backend
|
||||
>>> s = get_search_backend()
|
||||
|
||||
# Run a search for a book by Roald Dahl
|
||||
|
|
|
@ -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!")
|
||||
|
||||
|
||||
|
@ -50,7 +50,7 @@ Wagtail's document and image models provide a ``search`` method on their QuerySe
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
>>> from wagtail.wagtailimages.models import Image
|
||||
>>> from wagtail.images.models import Image
|
||||
|
||||
>>> Image.objects.filter(uploaded_by_user=user).search("Hello")
|
||||
[<Image: Hello>, <Image: Hello world!>]
|
||||
|
@ -61,7 +61,7 @@ Wagtail's document and image models provide a ``search`` method on their QuerySe
|
|||
.. code-block:: python
|
||||
|
||||
>>> from myapp.models import Book
|
||||
>>> from wagtail.wagtailsearch.backends import get_search_backend
|
||||
>>> from wagtail.search.backends import get_search_backend
|
||||
|
||||
# Search books
|
||||
>>> s = get_search_backend()
|
||||
|
@ -74,7 +74,7 @@ You can also pass a QuerySet into the ``search`` method which allows you to add
|
|||
.. code-block:: python
|
||||
|
||||
>>> from myapp.models import Book
|
||||
>>> from wagtail.wagtailsearch.backends import get_search_backend
|
||||
>>> from wagtail.search.backends import get_search_backend
|
||||
|
||||
# Search books
|
||||
>>> s = get_search_backend()
|
||||
|
@ -206,8 +206,8 @@ 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.wagtailsearch.models import Query
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.search.models import Query
|
||||
|
||||
|
||||
def search(request):
|
||||
|
@ -267,4 +267,4 @@ Promoted search results
|
|||
|
||||
"Promoted search results" allow editors to explicitly link relevant content to search terms, so results pages can contain curated content in addition to results from the search engine.
|
||||
|
||||
This functionality is provided by the :mod:`~wagtail.contrib.wagtailsearchpromotions` contrib module.
|
||||
This functionality is provided by the :mod:`~wagtail.contrib.search_promotions` contrib module.
|
||||
|
|
|
@ -17,8 +17,8 @@ Here's an example snippet model:
|
|||
|
||||
from django.db import models
|
||||
|
||||
from wagtail.wagtailadmin.edit_handlers import FieldPanel
|
||||
from wagtail.wagtailsnippets.models import register_snippet
|
||||
from wagtail.admin.edit_handlers import FieldPanel
|
||||
from wagtail.snippets.models import register_snippet
|
||||
|
||||
...
|
||||
|
||||
|
@ -103,7 +103,7 @@ In the above example, the list of adverts is a fixed list, displayed independent
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailsnippets.edit_handlers import SnippetChooserPanel
|
||||
from wagtail.snippets.edit_handlers import SnippetChooserPanel
|
||||
# ...
|
||||
class BookPage(Page):
|
||||
advert = models.ForeignKey(
|
||||
|
@ -129,8 +129,8 @@ 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.wagtailsnippets.edit_handlers import SnippetChooserPanel
|
||||
from wagtail.core.models import Page, Orderable
|
||||
from wagtail.snippets.edit_handlers import SnippetChooserPanel
|
||||
|
||||
from modelcluster.fields import ParentalKey
|
||||
|
||||
|
@ -180,13 +180,13 @@ These child objects are now accessible through the page's ``advert_placements``
|
|||
Making Snippets Searchable
|
||||
--------------------------
|
||||
|
||||
If a snippet model inherits from ``wagtail.wagtailsearch.index.Indexed``, as described in :ref:`wagtailsearch_indexing_models`, Wagtail will automatically add a search box to the chooser interface for that snippet type. For example, the ``Advert`` snippet could be made searchable as follows:
|
||||
If a snippet model inherits from ``wagtail.search.index.Indexed``, as described in :ref:`wagtailsearch_indexing_models`, Wagtail will automatically add a search box to the chooser interface for that snippet type. For example, the ``Advert`` snippet could be made searchable as follows:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
...
|
||||
|
||||
from wagtail.wagtailsearch import index
|
||||
from wagtail.search import index
|
||||
|
||||
...
|
||||
|
||||
|
|
|
@ -19,11 +19,11 @@ 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.wagtailadmin.edit_handlers import FieldPanel, StreamFieldPanel
|
||||
from wagtail.wagtailimages.blocks import ImageChooserBlock
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.core.fields import StreamField
|
||||
from wagtail.core import blocks
|
||||
from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel
|
||||
from wagtail.images.blocks import ImageChooserBlock
|
||||
|
||||
class BlogPage(Page):
|
||||
author = models.CharField(max_length=255)
|
||||
|
@ -61,7 +61,7 @@ All block types accept the following optional keyword arguments:
|
|||
The label to display in the editor interface when referring to this block - defaults to a prettified version of the block name (or, in a context where no name is assigned - such as within a ``ListBlock`` - the empty string).
|
||||
|
||||
``icon``
|
||||
The name of the icon to display for this block type in the menu of available block types. For a list of icon names, see the Wagtail style guide, which can be enabled by adding ``wagtail.contrib.wagtailstyleguide`` to your project's ``INSTALLED_APPS``.
|
||||
The name of the icon to display for this block type in the menu of available block types. For a list of icon names, see the Wagtail style guide, which can be enabled by adding ``wagtail.contrib.styleguide`` to your project's ``INSTALLED_APPS``.
|
||||
|
||||
``template``
|
||||
The path to a Django template that will be used to render this block on the front end. See `Template rendering`_.
|
||||
|
@ -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:
|
||||
|
||||
|
@ -270,28 +270,28 @@ A control for selecting a page object, using Wagtail's page browser. The followi
|
|||
DocumentChooserBlock
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
``wagtail.wagtaildocs.blocks.DocumentChooserBlock``
|
||||
``wagtail.documents.blocks.DocumentChooserBlock``
|
||||
|
||||
A control to allow the editor to select an existing document object, or upload a new one. The keyword argument ``required`` (default: True) is accepted.
|
||||
|
||||
ImageChooserBlock
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailimages.blocks.ImageChooserBlock``
|
||||
``wagtail.images.blocks.ImageChooserBlock``
|
||||
|
||||
A control to allow the editor to select an existing image, or upload a new one. The keyword argument ``required`` (default: True) is accepted.
|
||||
|
||||
SnippetChooserBlock
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailsnippets.blocks.SnippetChooserBlock``
|
||||
``wagtail.snippets.blocks.SnippetChooserBlock``
|
||||
|
||||
A control to allow the editor to select a snippet object. Requires one positional argument: the snippet class to choose from. The keyword argument ``required`` (default: True) is accepted.
|
||||
|
||||
EmbedBlock
|
||||
~~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailembeds.blocks.EmbedBlock``
|
||||
``wagtail.embeds.blocks.EmbedBlock``
|
||||
|
||||
A field for the editor to enter a URL to a media item (such as a YouTube video) to appear as embedded media on the page. The keyword arguments ``required`` (default: True), ``max_length``, ``min_length`` and ``help_text`` 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
|
||||
|
||||
|
@ -885,10 +885,8 @@ If you change an existing RichTextField to a StreamField, and create and run mig
|
|||
.. code-block:: python
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
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):
|
||||
|
@ -931,14 +929,12 @@ Note that the above migration will work on published Page objects only. If you a
|
|||
.. code-block:: python
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import json
|
||||
|
||||
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):
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# This is a sample uWSGI configuration file for running a Wagtail application.
|
||||
# It's designed to run under uWSGI's Emperor mode[0], but should work fine as
|
||||
# a standalone instance, e.g. under supervisord using
|
||||
# a standalone instance, e.g. under supervisord using
|
||||
# 'uwsgi --ini /path/to/wagtail.ini'.
|
||||
#
|
||||
# This configuration assumes an application called 'mywagtail', running under
|
||||
|
@ -38,7 +38,7 @@ stats = /home/mywagtail/mywagtail.stats
|
|||
master = true
|
||||
|
||||
# Set this to the root directory of your project.
|
||||
chdir = /home/mywagtail/app
|
||||
chdir = /home/mywagtail/app
|
||||
# ... and its virtualenv.
|
||||
virtualenv = /home/mywagtail/venv
|
||||
|
||||
|
@ -79,10 +79,10 @@ env = DJANGO_SETTINGS_MODULE=myapp.settings.production
|
|||
# WSGI application. Wagtail includes this in the default template.
|
||||
module = mywagtail.wsgi:application
|
||||
|
||||
# You can run addational daemons along with the application; for example,
|
||||
# You can run additional daemons along with the application; for example,
|
||||
# if you want to run Celery:
|
||||
attach-daemon = celery worker -A myceleryapp -C -c1
|
||||
attach-daemon = celery beat -A myceleryapp -C
|
||||
attach-daemon = celery beat -A myceleryapp -C
|
||||
|
||||
# Log errors and requests.
|
||||
logto = /var/log/uwsgi/mywagtail.log
|
||||
|
|
|
@ -23,19 +23,15 @@ App.prototype.scssSources = function() {
|
|||
|
||||
// All the Wagtail apps that contain static files
|
||||
var apps = [
|
||||
new App('wagtail/wagtailadmin'),
|
||||
new App('wagtail/wagtaildocs'),
|
||||
new App('wagtail/wagtailembeds'),
|
||||
new App('wagtail/wagtailimages'),
|
||||
new App('wagtail/wagtailsnippets'),
|
||||
new App('wagtail/wagtailusers'),
|
||||
new App('wagtail/contrib/wagtailstyleguide'),
|
||||
new App('wagtail/contrib/settings', {
|
||||
'appName': 'wagtailsettings',
|
||||
}),
|
||||
new App('wagtail/contrib/modeladmin', {
|
||||
'appName': 'wagtailmodeladmin',
|
||||
}),
|
||||
new App('wagtail/admin', {'appName': 'wagtailadmin'}),
|
||||
new App('wagtail/documents', {'appName': 'wagtaildocs'}),
|
||||
new App('wagtail/embeds', {'appName': 'wagtailembeds'}),
|
||||
new App('wagtail/images', {'appName': 'wagtailimages'}),
|
||||
new App('wagtail/snippets', {'appName': 'wagtailimages'}),
|
||||
new App('wagtail/users', {'appName': 'wagtailusers'}),
|
||||
new App('wagtail/contrib/styleguide', {'appName': 'wagtailstyleguide'}),
|
||||
new App('wagtail/contrib/settings', {'appName': 'wagtailsettings'}),
|
||||
new App('wagtail/contrib/modeladmin', {'appName': 'wagtailmodeladmin'}),
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import shutil
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from __future__ import print_function
|
||||
import subprocess
|
||||
import re
|
||||
from collections import defaultdict
|
||||
|
|
|
@ -10,7 +10,6 @@ max-line-length = 120
|
|||
line_length=100
|
||||
multi_line_output=4
|
||||
skip=migrations,project_template
|
||||
add_imports=from __future__ import absolute_import,from __future__ import unicode_literals
|
||||
known_first_party=wagtail
|
||||
known_third_party=willow,modelcluster,taggit,django,unidecode,bs4,pytz,PIL
|
||||
|
||||
|
|
4
tox.ini
4
tox.ini
|
@ -26,8 +26,8 @@ ignore = D100,D101,D102,D103,D105,D200,D202,D204,D205,D209,D400,D401,E303,E501,N
|
|||
[testenv]
|
||||
install_command = pip install -e ".[testing]" -U {opts} {packages}
|
||||
commands =
|
||||
elasticsearch2: coverage run runtests.py wagtail.wagtailsearch wagtail.wagtaildocs wagtail.wagtailimages --elasticsearch2
|
||||
elasticsearch5: coverage run runtests.py wagtail.wagtailsearch wagtail.wagtaildocs wagtail.wagtailimages --elasticsearch5
|
||||
elasticsearch2: coverage run runtests.py wagtail.search wagtail.documents wagtail.images --elasticsearch2
|
||||
elasticsearch5: coverage run runtests.py wagtail.search wagtail.documents wagtail.images --elasticsearch5
|
||||
noelasticsearch: coverage run runtests.py
|
||||
|
||||
basepython =
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from wagtail.utils.version import get_semver_version, get_version
|
||||
|
||||
# major.minor.patch.release.number
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
default_app_config = 'wagtail.admin.apps.WagtailAdminAppConfig'
|
|
@ -1,5 +1,3 @@
|
|||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
from wagtail.api.v2.endpoints import PagesAPIEndpoint
|
||||
|
@ -7,7 +5,7 @@ from wagtail.api.v2.filters import (
|
|||
ChildOfFilter, DescendantOfFilter, FieldsFilter, ForExplorerFilter, OrderingFilter,
|
||||
SearchFilter)
|
||||
from wagtail.api.v2.utils import BadRequestError, filter_page_type, page_models_from_string
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.core.models import Page
|
||||
|
||||
from .filters import HasChildrenFilter
|
||||
from .serializers import AdminPageSerializer
|
||||
|
@ -93,11 +91,11 @@ class PagesAdminAPIEndpoint(PagesAPIEndpoint):
|
|||
return types
|
||||
|
||||
def listing_view(self, request):
|
||||
response = super(PagesAdminAPIEndpoint, self).listing_view(request)
|
||||
response = super().listing_view(request)
|
||||
response.data['__types'] = self.get_type_info()
|
||||
return response
|
||||
|
||||
def detail_view(self, request, pk):
|
||||
response = super(PagesAdminAPIEndpoint, self).detail_view(request, pk)
|
||||
response = super().detail_view(request, pk)
|
||||
response.data['__types'] = self.get_type_info()
|
||||
return response
|
|
@ -1,5 +1,3 @@
|
|||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from rest_framework.filters import BaseFilterBackend
|
||||
|
||||
from wagtail.api.v2.utils import BadRequestError, parse_boolean
|
|
@ -1,12 +1,10 @@
|
|||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
from rest_framework.fields import Field, ReadOnlyField
|
||||
|
||||
from wagtail.api.v2.serializers import PageSerializer
|
||||
from wagtail.api.v2.utils import get_full_url
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.core.models import Page
|
||||
|
||||
|
||||
def get_model_listing_url(context, model):
|
|
@ -1,9 +1,7 @@
|
|||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from django.conf.urls import url
|
||||
|
||||
from wagtail.api.v2.router import WagtailAPIRouter
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.core import hooks
|
||||
|
||||
from .endpoints import PagesAdminAPIEndpoint
|
||||
|
|
@ -1,11 +1,9 @@
|
|||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
from . import checks # NOQA
|
||||
|
||||
|
||||
class WagtailAdminAppConfig(AppConfig):
|
||||
name = 'wagtail.wagtailadmin'
|
||||
name = 'wagtail.admin'
|
||||
label = 'wagtailadmin'
|
||||
verbose_name = "Wagtail admin"
|
|
@ -0,0 +1,5 @@
|
|||
import warnings
|
||||
|
||||
from wagtail.core.blocks import * # noqa
|
||||
|
||||
warnings.warn("wagtail.admin.blocks has moved to wagtail.core.blocks", UserWarning, stacklevel=2)
|
|
@ -1,5 +1,3 @@
|
|||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import os
|
||||
|
||||
from django.core.checks import Error, Warning, register
|
||||
|
@ -34,8 +32,8 @@ def css_install_check(app_configs, **kwargs):
|
|||
|
||||
@register()
|
||||
def base_form_class_check(app_configs, **kwargs):
|
||||
from wagtail.wagtailadmin.forms import WagtailAdminPageForm
|
||||
from wagtail.wagtailcore.models import get_page_models
|
||||
from wagtail.admin.forms import WagtailAdminPageForm
|
||||
from wagtail.core.models import get_page_models
|
||||
|
||||
errors = []
|
||||
|
||||
|
@ -55,8 +53,8 @@ def base_form_class_check(app_configs, **kwargs):
|
|||
|
||||
@register()
|
||||
def get_form_class_check(app_configs, **kwargs):
|
||||
from wagtail.wagtailadmin.forms import WagtailAdminPageForm
|
||||
from wagtail.wagtailcore.models import get_page_models
|
||||
from wagtail.admin.forms import WagtailAdminPageForm
|
||||
from wagtail.core.models import get_page_models
|
||||
|
||||
errors = []
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import difflib
|
||||
|
||||
from bs4 import BeautifulSoup
|
|
@ -1,8 +1,7 @@
|
|||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
|
||||
# Adapted from https://djangosnippets.org/snippets/10563/
|
||||
# original author bernd-wechner
|
||||
|
||||
|
||||
def to_datetimepicker_format(python_format_string):
|
||||
"""
|
||||
Given a python datetime format string, attempts to convert it to
|
|
@ -1,12 +1,10 @@
|
|||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from django.contrib.auth.views import redirect_to_login as auth_redirect_to_login
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import activate as activate_lang
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from wagtail.wagtailadmin import messages
|
||||
from wagtail.admin import messages
|
||||
|
||||
|
||||
def reject_request(request):
|
|
@ -1,5 +1,3 @@
|
|||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import math
|
||||
import re
|
||||
|
||||
|
@ -14,10 +12,10 @@ from django.utils.translation import ugettext_lazy
|
|||
from taggit.managers import TaggableManager
|
||||
|
||||
from wagtail.utils.decorators import cached_classmethod
|
||||
from wagtail.wagtailadmin import compare, widgets
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.wagtailcore.utils import camelcase_to_underscore, resolve_model_string
|
||||
from wagtail.admin import compare, widgets
|
||||
from wagtail.core.fields import RichTextField
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.core.utils import camelcase_to_underscore, resolve_model_string
|
||||
|
||||
# DIRECT_FORM_FIELD_OVERRIDES, FORM_FIELD_OVERRIDES are imported for backwards
|
||||
# compatibility, as people are likely importing them from here and then
|
||||
|
@ -87,7 +85,7 @@ def extract_panel_definitions_from_model_class(model, exclude=None):
|
|||
return panels
|
||||
|
||||
|
||||
class EditHandler(object):
|
||||
class EditHandler:
|
||||
"""
|
||||
Abstract class providing sensible default behaviours for objects implementing
|
||||
the EditHandler API
|
||||
|
@ -134,7 +132,7 @@ class EditHandler(object):
|
|||
def classes(self):
|
||||
"""
|
||||
Additional CSS classnames to add to whatever kind of object this is at output.
|
||||
Subclasses of EditHandler should override this, invoking super(B, self).classes() to
|
||||
Subclasses of EditHandler should override this, invoking super().classes() to
|
||||
append more classes specific to the situation.
|
||||
"""
|
||||
|
||||
|
@ -253,7 +251,7 @@ class BaseCompositeEditHandler(EditHandler):
|
|||
return mark_safe(''.join([c.html_declarations() for c in cls.children]))
|
||||
|
||||
def __init__(self, instance=None, form=None):
|
||||
super(BaseCompositeEditHandler, self).__init__(instance=instance, form=form)
|
||||
super().__init__(instance=instance, form=form)
|
||||
|
||||
self.children = []
|
||||
for child in self.__class__.children:
|
||||
|
@ -321,7 +319,7 @@ class BaseTabbedInterface(BaseFormEditHandler):
|
|||
template = "wagtailadmin/edit_handlers/tabbed_interface.html"
|
||||
|
||||
|
||||
class TabbedInterface(object):
|
||||
class TabbedInterface:
|
||||
def __init__(self, children, base_form_class=None):
|
||||
self.children = children
|
||||
self.base_form_class = base_form_class
|
||||
|
@ -338,7 +336,7 @@ class BaseObjectList(BaseFormEditHandler):
|
|||
template = "wagtailadmin/edit_handlers/object_list.html"
|
||||
|
||||
|
||||
class ObjectList(object):
|
||||
class ObjectList:
|
||||
def __init__(self, children, heading="", classname="",
|
||||
base_form_class=None):
|
||||
self.children = children
|
||||
|
@ -360,7 +358,7 @@ class BaseFieldRowPanel(BaseCompositeEditHandler):
|
|||
template = "wagtailadmin/edit_handlers/field_row_panel.html"
|
||||
|
||||
|
||||
class FieldRowPanel(object):
|
||||
class FieldRowPanel:
|
||||
def __init__(self, children, classname=""):
|
||||
self.children = children
|
||||
self.classname = classname
|
||||
|
@ -385,13 +383,13 @@ class BaseMultiFieldPanel(BaseCompositeEditHandler):
|
|||
template = "wagtailadmin/edit_handlers/multi_field_panel.html"
|
||||
|
||||
def classes(self):
|
||||
classes = super(BaseMultiFieldPanel, self).classes()
|
||||
classes = super().classes()
|
||||
classes.append("multi-field")
|
||||
|
||||
return classes
|
||||
|
||||
|
||||
class MultiFieldPanel(object):
|
||||
class MultiFieldPanel:
|
||||
def __init__(self, children, heading="", classname=""):
|
||||
self.children = children
|
||||
self.heading = heading
|
||||
|
@ -419,14 +417,14 @@ class BaseFieldPanel(EditHandler):
|
|||
return {}
|
||||
|
||||
def __init__(self, instance=None, form=None):
|
||||
super(BaseFieldPanel, self).__init__(instance=instance, form=form)
|
||||
super().__init__(instance=instance, form=form)
|
||||
self.bound_field = self.form[self.field_name]
|
||||
|
||||
self.heading = self.bound_field.label
|
||||
self.help_text = self.bound_field.help_text
|
||||
|
||||
def classes(self):
|
||||
classes = super(BaseFieldPanel, self).classes()
|
||||
classes = super().classes()
|
||||
|
||||
if self.bound_field.field.required:
|
||||
classes.append("required")
|
||||
|
@ -504,7 +502,7 @@ class BaseFieldPanel(EditHandler):
|
|||
return []
|
||||
|
||||
|
||||
class FieldPanel(object):
|
||||
class FieldPanel:
|
||||
def __init__(self, field_name, classname="", widget=None):
|
||||
self.field_name = field_name
|
||||
self.classname = classname
|
||||
|
@ -529,7 +527,7 @@ class BaseRichTextFieldPanel(BaseFieldPanel):
|
|||
return compare.RichTextFieldComparison
|
||||
|
||||
|
||||
class RichTextFieldPanel(object):
|
||||
class RichTextFieldPanel:
|
||||
def __init__(self, field_name):
|
||||
self.field_name = field_name
|
||||
|
||||
|
@ -608,7 +606,7 @@ class BasePageChooserPanel(BaseChooserPanel):
|
|||
return [cls.model._meta.get_field(cls.field_name).remote_field.model]
|
||||
|
||||
|
||||
class PageChooserPanel(object):
|
||||
class PageChooserPanel:
|
||||
def __init__(self, field_name, page_type=None, can_choose_root=False):
|
||||
self.field_name = field_name
|
||||
|
||||
|
@ -686,7 +684,7 @@ class BaseInlinePanel(EditHandler):
|
|||
return [curry(compare.ChildRelationComparison, field, field_comparisons)]
|
||||
|
||||
def __init__(self, instance=None, form=None):
|
||||
super(BaseInlinePanel, self).__init__(instance=instance, form=form)
|
||||
super().__init__(instance=instance, form=form)
|
||||
|
||||
self.formset = form.formsets[self.__class__.relation_name]
|
||||
|
||||
|
@ -735,7 +733,7 @@ class BaseInlinePanel(EditHandler):
|
|||
}))
|
||||
|
||||
|
||||
class InlinePanel(object):
|
||||
class InlinePanel:
|
||||
def __init__(self, relation_name, panels=None, classname='', label='', help_text='', min_num=None, max_num=None):
|
||||
self.relation_name = relation_name
|
||||
self.panels = panels
|
||||
|
@ -824,7 +822,7 @@ Page.get_edit_handler = get_edit_handler
|
|||
|
||||
class BaseStreamFieldPanel(BaseFieldPanel):
|
||||
def classes(self):
|
||||
classes = super(BaseStreamFieldPanel, self).classes()
|
||||
classes = super().classes()
|
||||
classes.append("stream-field")
|
||||
|
||||
# In case of a validation error, BlockWidget will take care of outputting the error on the
|
||||
|
@ -848,7 +846,7 @@ class BaseStreamFieldPanel(BaseFieldPanel):
|
|||
return ""
|
||||
|
||||
|
||||
class StreamFieldPanel(object):
|
||||
class StreamFieldPanel:
|
||||
def __init__(self, field_name, classname=''):
|
||||
self.field_name = field_name
|
||||
self.classname = classname
|
|
@ -1,5 +1,3 @@
|
|||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import copy
|
||||
from itertools import groupby
|
||||
|
||||
|
@ -12,14 +10,13 @@ from django.db import models, transaction
|
|||
from django.forms.widgets import TextInput
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils import timezone
|
||||
from django.utils.six import with_metaclass
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import ugettext_lazy, ungettext
|
||||
from modelcluster.forms import ClusterForm, ClusterFormMetaclass
|
||||
from taggit.managers import TaggableManager
|
||||
|
||||
from wagtail.wagtailadmin import widgets
|
||||
from wagtail.wagtailcore.models import (
|
||||
from wagtail.admin import widgets
|
||||
from wagtail.core.models import (
|
||||
BaseViewRestriction, Collection, CollectionViewRestriction, GroupCollectionPermission, Page,
|
||||
PageViewRestriction)
|
||||
|
||||
|
@ -33,7 +30,7 @@ class URLOrAbsolutePathValidator(validators.URLValidator):
|
|||
if URLOrAbsolutePathValidator.is_absolute_path(value):
|
||||
return None
|
||||
else:
|
||||
return super(URLOrAbsolutePathValidator, self).__call__(value)
|
||||
return super().__call__(value)
|
||||
|
||||
|
||||
class URLOrAbsolutePathField(forms.URLField):
|
||||
|
@ -42,14 +39,14 @@ class URLOrAbsolutePathField(forms.URLField):
|
|||
|
||||
def to_python(self, value):
|
||||
if not URLOrAbsolutePathValidator.is_absolute_path(value):
|
||||
value = super(URLOrAbsolutePathField, self).to_python(value)
|
||||
value = super().to_python(value)
|
||||
return value
|
||||
|
||||
|
||||
class SearchForm(forms.Form):
|
||||
def __init__(self, *args, **kwargs):
|
||||
placeholder = kwargs.pop('placeholder', _("Search"))
|
||||
super(SearchForm, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields['q'].widget.attrs = {'placeholder': placeholder}
|
||||
|
||||
q = forms.CharField(label=ugettext_lazy("Search term"), widget=forms.TextInput())
|
||||
|
@ -77,7 +74,7 @@ class LoginForm(AuthenticationForm):
|
|||
)
|
||||
|
||||
def __init__(self, request=None, *args, **kwargs):
|
||||
super(LoginForm, self).__init__(request=request, *args, **kwargs)
|
||||
super().__init__(request=request, *args, **kwargs)
|
||||
self.fields['username'].widget.attrs['placeholder'] = ugettext_lazy("Enter your %s") \
|
||||
% self.username_field.verbose_name
|
||||
|
||||
|
@ -86,7 +83,7 @@ class PasswordResetForm(PasswordResetForm):
|
|||
email = forms.EmailField(label=ugettext_lazy("Enter your email address to reset your password"), max_length=254)
|
||||
|
||||
def clean(self):
|
||||
cleaned_data = super(PasswordResetForm, self).clean()
|
||||
cleaned_data = super().clean()
|
||||
|
||||
# Find users of this email address
|
||||
UserModel = get_user_model()
|
||||
|
@ -121,7 +118,7 @@ class CopyForm(forms.Form):
|
|||
self.page = kwargs.pop('page')
|
||||
self.user = kwargs.pop('user', None)
|
||||
can_publish = kwargs.pop('can_publish')
|
||||
super(CopyForm, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields['new_title'] = forms.CharField(initial=self.page.title, label=_("New title"))
|
||||
self.fields['new_slug'] = forms.SlugField(initial=self.page.slug, label=_("New slug"))
|
||||
self.fields['new_parent_page'] = forms.ModelChoiceField(
|
||||
|
@ -160,7 +157,7 @@ class CopyForm(forms.Form):
|
|||
)
|
||||
|
||||
def clean(self):
|
||||
cleaned_data = super(CopyForm, self).clean()
|
||||
cleaned_data = super().clean()
|
||||
|
||||
# Make sure the slug isn't already in use
|
||||
slug = cleaned_data.get('new_slug')
|
||||
|
@ -197,7 +194,7 @@ class BaseViewRestrictionForm(forms.ModelForm):
|
|||
widget=forms.RadioSelect)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(BaseViewRestrictionForm, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
self.fields['groups'].widget = forms.CheckboxSelectMultiple()
|
||||
self.fields['groups'].queryset = Group.objects.all()
|
||||
|
@ -293,11 +290,11 @@ class WagtailAdminModelFormMetaclass(ClusterFormMetaclass):
|
|||
return new_class
|
||||
|
||||
|
||||
class WagtailAdminModelForm(with_metaclass(WagtailAdminModelFormMetaclass, ClusterForm)):
|
||||
class WagtailAdminModelForm(ClusterForm, metaclass=WagtailAdminModelFormMetaclass):
|
||||
@property
|
||||
def media(self):
|
||||
# Include media from formsets forms. This allow StreamField in InlinePanel for example.
|
||||
media = super(WagtailAdminModelForm, self).media
|
||||
media = super().media
|
||||
for formset in self.formsets.values():
|
||||
media += formset.media
|
||||
return media
|
||||
|
@ -315,12 +312,12 @@ class WagtailAdminPageForm(WagtailAdminModelForm):
|
|||
exclude = ['content_type', 'path', 'depth', 'numchild']
|
||||
|
||||
def __init__(self, data=None, files=None, parent_page=None, *args, **kwargs):
|
||||
super(WagtailAdminPageForm, self).__init__(data, files, *args, **kwargs)
|
||||
super().__init__(data, files, *args, **kwargs)
|
||||
self.parent_page = parent_page
|
||||
|
||||
def clean(self):
|
||||
|
||||
cleaned_data = super(WagtailAdminPageForm, self).clean()
|
||||
cleaned_data = super().clean()
|
||||
if 'slug' in self.cleaned_data:
|
||||
if not Page._slug_is_available(
|
||||
cleaned_data['slug'], self.parent_page, self.instance
|
||||
|
@ -368,7 +365,7 @@ class BaseCollectionMemberForm(forms.ModelForm):
|
|||
def __init__(self, *args, **kwargs):
|
||||
user = kwargs.pop('user', None)
|
||||
|
||||
super(BaseCollectionMemberForm, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
if user is None:
|
||||
self.collections = Collection.objects.all()
|
||||
|
@ -399,7 +396,7 @@ class BaseCollectionMemberForm(forms.ModelForm):
|
|||
# populate the instance's collection field with the one available collection
|
||||
self.instance.collection = self.collections[0]
|
||||
|
||||
return super(BaseCollectionMemberForm, self).save(commit=commit)
|
||||
return super().save(commit=commit)
|
||||
|
||||
|
||||
class BaseGroupCollectionMemberPermissionFormSet(forms.BaseFormSet):
|
||||
|
@ -434,7 +431,7 @@ class BaseGroupCollectionMemberPermissionFormSet(forms.BaseFormSet):
|
|||
'permissions': [cp.permission for cp in collection_permissions]
|
||||
})
|
||||
|
||||
super(BaseGroupCollectionMemberPermissionFormSet, self).__init__(
|
||||
super().__init__(
|
||||
data, files, initial=initial_data, prefix=prefix
|
||||
)
|
||||
for form in self.forms:
|
||||
|
@ -442,7 +439,7 @@ class BaseGroupCollectionMemberPermissionFormSet(forms.BaseFormSet):
|
|||
|
||||
@property
|
||||
def empty_form(self):
|
||||
empty_form = super(BaseGroupCollectionMemberPermissionFormSet, self).empty_form
|
||||
empty_form = super().empty_form
|
||||
empty_form.fields['DELETE'].widget = forms.HiddenInput()
|
||||
return empty_form
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import jinja2
|
||||
from jinja2.ext import Extension
|
||||
|
||||
|
@ -8,7 +6,7 @@ from .templatetags.wagtailuserbar import wagtailuserbar
|
|||
|
||||
class WagtailUserbarExtension(Extension):
|
||||
def __init__(self, environment):
|
||||
super(WagtailUserbarExtension, self).__init__(environment)
|
||||
super().__init__(environment)
|
||||
|
||||
self.environment.globals.update({
|
||||
'wagtailuserbar': jinja2.contextfunction(wagtailuserbar),
|
Some files were not shown because too many files have changed in this diff Show More
Ładowanie…
Reference in New Issue