Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Update wagtail imports #379

Merged
merged 3 commits into from Sep 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 10 additions & 10 deletions docs/source/advanced_topics/custom_menu_classes.rst
Expand Up @@ -33,9 +33,9 @@ If you're happy with the default ``MainMenu`` model, but wish customise the menu
from django.db import models
from django.utils.translation import ugettext_lazy as _
from modelcluster.fields import ParentalKey
from wagtail.wagtailimages import get_image_model_string
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
from wagtail.wagtailadmin.edit_handlers import FieldPanel, PageChooserPanel
from wagtail.images import get_image_model_string
from wagtail.images.edit_handlers import ImageChooserPanel
from wagtail.admin.edit_handlers import FieldPanel, PageChooserPanel
from wagtailmenus.models import AbstractMainMenuItem


Expand Down Expand Up @@ -113,7 +113,7 @@ If you also need to override the ``MainMenu`` model, that's possible too. But, b
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from modelcluster.fields import ParentalKey
from wagtail.wagtailadmin.edit_handlers import FieldPanel, MultiFieldPanel, PageChooserPanel
from wagtail.admin.edit_handlers import FieldPanel, MultiFieldPanel, PageChooserPanel
from wagtailmenus.conf import settings
from wagtailmenus.models import AbstractMainMenu, AbstractMainMenuItem

Expand Down Expand Up @@ -208,9 +208,9 @@ If you're happy with the default ``FlatMenu`` model, but wish customise the menu
from django.db import models
from django.utils.translation import ugettext_lazy as _
from modelcluster.fields import ParentalKey
from wagtail.wagtailimages import get_image_model_string
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
from wagtail.wagtailadmin.edit_handlers import FieldPanel, PageChooserPanel
from wagtail.images import get_image_model_string
from wagtail.images.edit_handlers import ImageChooserPanel
from wagtail.admin.edit_handlers import FieldPanel, PageChooserPanel
from wagtailmenus.models import AbstractFlatMenuItem


Expand Down Expand Up @@ -289,7 +289,7 @@ If you also need to override the ``FlatMenu`` model, that's possible too. But, b
from django.utils import translation
from django.utils.translation import ugettext_lazy as _
from modelcluster.fields import ParentalKey
from wagtail.wagtailadmin.edit_handlers import FieldPanel, MultiFieldPanel, PageChooserPanel
from wagtail.admin.edit_handlers import FieldPanel, MultiFieldPanel, PageChooserPanel
from wagtailmenus.conf import settings
from wagtailmenus.panels import FlatMenuItemsInlinePanel
from wagtailmenus.models import AbstractFlatMenu, AbstractFlatMenuItem
Expand Down Expand Up @@ -437,7 +437,7 @@ The class ``wagtailmenus.models.menus.SectionMenu`` is used by default, but you
# mysite/appname/models.py

from django.utils.translation import ugettext_lazy as _
from wagtail.wagtailcore.models import Page
from wagtail.core.models import Page
from wagtailmenus.models import SectionMenu


Expand Down Expand Up @@ -472,7 +472,7 @@ The class ``wagtailmenus.models.menus.ChildrenMenu`` is used by default, but you
# appname/menus.py

from django.utils.translation import ugettext_lazy as _
from wagtail.wagtailcore.models import Page
from wagtail.core.models import Page
from wagtailmenus.models import ChildrenMenu


Expand Down
18 changes: 9 additions & 9 deletions docs/source/advanced_topics/hooks.rst
Expand Up @@ -11,7 +11,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...)
Expand Down Expand Up @@ -63,7 +63,7 @@ However, if you'd like to filter this result down further, you can do so using s

.. code-block:: python

from wagtail.wagtailcore import hooks
from wagtail.core import hooks

@hooks.register('menus_modify_base_page_queryset')
def make_some_changes(
Expand All @@ -76,7 +76,7 @@ However, if you'd like to filter this result down further, you can do so using s
"""
if not request.user.is_authenticated():
return queryset.none()
return queryset.filter(owner=self.request.user)
return queryset.filter(owner=request.user)


This would ensure that only pages 'owned' by currently logged-in user will appear in menus. And the changes will be applied to ALL types of menu, regardless of what template tag is being called to do the rendering.
Expand All @@ -86,7 +86,7 @@ Or, if you only wanted to change the queryset for a menu of a specific type, you

.. code-block:: python

from wagtail.wagtailcore import hooks
from wagtail.core import hooks

@hooks.register('menus_modify_base_page_queryset')
def make_some_changes(
Expand All @@ -101,7 +101,7 @@ Or, if you only wanted to change the queryset for a menu of a specific type, you
if menu_type in ('main_menu', 'flat_menu'):
if not request.user.is_authenticated():
return queryset.none()
queryset = queryset.filter(owner=self.request.user)
queryset = queryset.filter(owner=request.user)

return queryset # always return a queryset

Expand All @@ -124,7 +124,7 @@ However, if you'd only like to include a subset of the CMS-defined menu item, or

.. code-block:: python

from wagtail.wagtailcore import hooks
from wagtail.core import hooks

@hooks.register('menus_modify_base_menuitem_queryset')
def make_some_changes(
Expand All @@ -149,7 +149,7 @@ These changes would be applied to all menu types that use menu items to define t

.. code-block:: python

from wagtail.wagtailcore import hooks
from wagtail.core import hooks

@hooks.register('menus_modify_base_menuitem_queryset')
def make_some_changes(
Expand Down Expand Up @@ -193,7 +193,7 @@ This hook allows you to modify the list **before** it is 'primed' (a process tha

.. code-block:: python

from wagtail.wagtailcore import hooks
from wagtail.core import hooks

@hooks.register('menus_modify_raw_menu_items')
def make_some_changes(
Expand Down Expand Up @@ -233,7 +233,7 @@ This hook allows you to modify the list of items **after** they have been 'prime

.. code-block:: python

from wagtail.wagtailcore import hooks
from wagtail.core import hooks

@hooks.register('menus_modify_primed_menu_items')
def make_some_changes(
Expand Down
2 changes: 1 addition & 1 deletion docs/source/menupage.rst
Expand Up @@ -158,7 +158,7 @@ Wagtail has a restriction that forbids models from subclassing more than one oth

# appname/models.py

from wagtail.wagtailforms.models import AbstractEmailForm
from wagtail.contrib.forms.models import AbstractEmailForm
from wagtailmenus.models import MenuPageMixin
from wagtailmenus.panels import menupage_panel

Expand Down
2 changes: 1 addition & 1 deletion docs/source/overview.rst
Expand Up @@ -203,7 +203,7 @@ Solves the problem of important page links becoming just 'toggles' in multi-leve
=======================================================================================

Extend the ``wagtailmenus.models.MenuPage`` model instead of the usual
``wagtail.wagtailcore.models.Page`` model to create your custom page types, and gain a
``wagtail.core.models.Page`` model to create your custom page types, and gain a
couple of extra fields that will allow you to configure certain pages to appear again
alongside their children in multi-level menus. Use the menu tags provided, and that
behaviour will remain consistent in all menus throughout your site. To find out more,
Expand Down
2 changes: 1 addition & 1 deletion docs/source/releases/2.4.0.rst
Expand Up @@ -33,7 +33,7 @@ New ``use_absolute_page_urls`` parameter added to template tags

The new parameter allows you to render menus that use 'absolute' URLs
for pages (including the protocol/domain derived from the relevant
``wagtailcore.models.Site`` object), instead of the 'relative' URLs used by
``wagtail.core.models.Site`` object), instead of the 'relative' URLs used by
default.


Expand Down