kopia lustrzana https://github.com/wagtail/wagtail
Reinstate isort
isort was disabled to avoid CI noise and merge conflicts following the renaming of Wagtail's module paths. Now that the last major merge of 2.0 has (hopefully) taken place, it's time to reinstate it.pull/4217/head
rodzic
e1325ed4d6
commit
d483c8d465
|
@ -11,7 +11,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
|
||||
|
|
|
@ -11,11 +11,11 @@ from django.utils.safestring import mark_safe
|
|||
from django.utils.translation import ugettext_lazy
|
||||
from taggit.managers import TaggableManager
|
||||
|
||||
from wagtail.utils.decorators import cached_classmethod
|
||||
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
|
||||
from wagtail.utils.decorators import cached_classmethod
|
||||
|
||||
# DIRECT_FORM_FIELD_OVERRIDES, FORM_FIELD_OVERRIDES are imported for backwards
|
||||
# compatibility, as people are likely importing them from here and then
|
||||
|
|
|
@ -2,7 +2,6 @@ import json
|
|||
import random
|
||||
import string
|
||||
|
||||
|
||||
ALPHANUM = string.ascii_lowercase + string.digits
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ from django.utils.functional import cached_property
|
|||
from wagtail.core import hooks
|
||||
from wagtail.core.rich_text import features as feature_registry
|
||||
from wagtail.core.rich_text.rewriters import EmbedRewriter, LinkRewriter, MultiRuleRewriter
|
||||
from wagtail.core.whitelist import allow_without_attributes, Whitelister
|
||||
from wagtail.core.whitelist import Whitelister, allow_without_attributes
|
||||
from wagtail.utils.deprecation import RemovedInWagtail22Warning
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from collections import Mapping
|
||||
import re
|
||||
from collections import Mapping
|
||||
|
||||
ELEMENT_SELECTOR = re.compile(r'^([\w-]+)$')
|
||||
ELEMENT_WITH_ATTR_SELECTOR = re.compile(r'^([\w-]+)\[([\w-]+)\]$')
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
from html.parser import HTMLParser
|
||||
import re
|
||||
from html.parser import HTMLParser
|
||||
|
||||
from wagtail.admin.rich_text.converters.contentstate_models import (
|
||||
Block, ContentState, Entity, EntityRange, InlineStyleRange
|
||||
)
|
||||
Block, ContentState, Entity, EntityRange, InlineStyleRange)
|
||||
from wagtail.admin.rich_text.converters.html_ruleset import HTMLRuleset
|
||||
from wagtail.core.rich_text import features as feature_registry
|
||||
from wagtail.core.models import Page
|
||||
|
||||
from wagtail.core.rich_text import features as feature_registry
|
||||
|
||||
# constants to keep track of what to do with leading whitespace on the next text node we encounter
|
||||
STRIP_WHITESPACE = 0
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from collections import OrderedDict
|
||||
import json
|
||||
from collections import OrderedDict
|
||||
|
||||
from django.forms import Media, widgets
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ from django.template.loader import render_to_string
|
|||
from django.utils.html import conditional_escape
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
from wagtail.utils.pagination import DEFAULT_PAGE_KEY, replace_page_in_query
|
||||
from wagtail.admin.menu import admin_menu
|
||||
from wagtail.admin.navigation import get_explorable_root_page
|
||||
from wagtail.admin.search import admin_search_areas
|
||||
|
@ -19,6 +18,7 @@ from wagtail.core.models import (
|
|||
CollectionViewRestriction, Page, PageViewRestriction, UserPagePermissionsProxy)
|
||||
from wagtail.core.utils import cautious_slugify as _cautious_slugify
|
||||
from wagtail.core.utils import camelcase_to_underscore, escape_script
|
||||
from wagtail.utils.pagination import DEFAULT_PAGE_KEY, replace_page_in_query
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ from django.urls import reverse
|
|||
from django.utils import timezone
|
||||
|
||||
from wagtail.api.v2.tests.test_pages import TestPageDetail, TestPageListing
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.tests.demosite import models
|
||||
from wagtail.tests.testapp.models import SimplePage, StreamPage
|
||||
from wagtail.core.models import Page
|
||||
|
||||
from .utils import AdminAPITestCase
|
||||
|
||||
|
|
|
@ -5,9 +5,8 @@ from django.core import mail
|
|||
from django.test import TestCase, override_settings
|
||||
from django.urls import reverse
|
||||
|
||||
from wagtail.admin.utils import WAGTAILADMIN_PROVIDED_LANGUAGES, get_available_admin_languages
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.admin.utils import (
|
||||
WAGTAILADMIN_PROVIDED_LANGUAGES, get_available_admin_languages)
|
||||
from wagtail.users.models import UserProfile
|
||||
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ from django.template import Context, Template
|
|||
from django.test import RequestFactory, TestCase
|
||||
from django.urls import reverse
|
||||
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.admin.utils import user_has_any_page_permission
|
||||
from wagtail.core.models import Site
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class BaseSearchAreaTestCase(WagtailTestUtils, TestCase):
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.admin import widgets as wagtailadmin_widgets
|
||||
from wagtail.core import hooks
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestButtonsHooks(TestCase, WagtailTestUtils):
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.core.models import Collection
|
||||
from wagtail.documents.models import Document
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestCollectionsIndexView(TestCase, WagtailTestUtils):
|
||||
|
|
|
@ -9,8 +9,8 @@ from wagtail.core.blocks import StreamValue
|
|||
from wagtail.images import get_image_model
|
||||
from wagtail.images.tests.utils import get_test_image_file
|
||||
from wagtail.tests.testapp.models import (
|
||||
EventCategory, EventPage, EventPageSpeaker, HeadCountRelatedModelUsingPK,
|
||||
SimplePage, StreamPage, TaggedPage)
|
||||
EventCategory, EventPage, EventPageSpeaker, HeadCountRelatedModelUsingPK, SimplePage,
|
||||
StreamPage, TaggedPage)
|
||||
|
||||
|
||||
class TestFieldComparison(TestCase):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import json
|
||||
from mock import patch
|
||||
|
||||
from django.test import TestCase
|
||||
from mock import patch
|
||||
|
||||
from wagtail.admin.rich_text.converters.contentstate import ContentstateConverter
|
||||
from wagtail.embeds.models import Embed
|
||||
|
|
|
@ -6,10 +6,6 @@ from django.core import checks
|
|||
from django.core.exceptions import FieldDoesNotExist, ImproperlyConfigured
|
||||
from django.test import TestCase, override_settings
|
||||
|
||||
from wagtail.tests.testapp.forms import ValidatedPageForm
|
||||
from wagtail.tests.testapp.models import (
|
||||
EventPage, EventPageChooserModel, EventPageSpeaker, PageChooserModel, SimplePage, ValidatedPage)
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.admin.edit_handlers import (
|
||||
FieldPanel, FieldRowPanel, InlinePanel, ObjectList, PageChooserPanel, RichTextFieldPanel,
|
||||
TabbedInterface, extract_panel_definitions_from_model_class, get_form_for_model)
|
||||
|
@ -18,6 +14,10 @@ from wagtail.admin.rich_text import DraftailRichTextArea
|
|||
from wagtail.admin.widgets import AdminAutoHeightTextInput, AdminDateInput, AdminPageChooser
|
||||
from wagtail.core.models import Page, Site
|
||||
from wagtail.images.edit_handlers import ImageChooserPanel
|
||||
from wagtail.tests.testapp.forms import ValidatedPageForm
|
||||
from wagtail.tests.testapp.models import (
|
||||
EventPage, EventPageChooserModel, EventPageSpeaker, PageChooserModel, SimplePage, ValidatedPage)
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestGetFormForModel(TestCase):
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
from django.contrib.auth import get_user_model
|
||||
from django.test import TestCase
|
||||
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.admin.navigation import (
|
||||
get_explorable_root_page, get_pages_with_direct_explore_permission)
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestExplorablePages(TestCase, WagtailTestUtils):
|
||||
|
|
|
@ -3,10 +3,10 @@ from django.test import TestCase
|
|||
from django.urls import reverse
|
||||
from django.utils.http import urlencode
|
||||
|
||||
from wagtail.tests.testapp.models import EventIndex, EventPage, SimplePage, SingleEventPage
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.admin.views.chooser import can_choose_page
|
||||
from wagtail.core.models import Page, UserPagePermissionsProxy
|
||||
from wagtail.tests.testapp.models import EventIndex, EventPage, SimplePage, SingleEventPage
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestChooserBrowse(TestCase, WagtailTestUtils):
|
||||
|
|
|
@ -19,17 +19,17 @@ from django.utils import formats, timezone
|
|||
from django.utils.dateparse import parse_date
|
||||
from freezegun import freeze_time
|
||||
|
||||
from wagtail.admin.views.home import RecentEditsPanel
|
||||
from wagtail.admin.views.pages import PreviewOnEdit
|
||||
from wagtail.core.models import GroupPagePermission, Page, PageRevision, Site
|
||||
from wagtail.core.signals import page_published, page_unpublished
|
||||
from wagtail.search.index import SearchField
|
||||
from wagtail.tests.testapp.models import (
|
||||
EVENT_AUDIENCE_CHOICES, Advert, AdvertPlacement, BusinessChild, BusinessIndex, BusinessSubIndex,
|
||||
DefaultStreamPage, EventCategory, EventPage, EventPageCarouselItem, FilePage,
|
||||
ManyToManyBlogPage, SimplePage, SingleEventPage, SingletonPage, StandardChild, StandardIndex,
|
||||
TaggedPage)
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.admin.views.home import RecentEditsPanel
|
||||
from wagtail.admin.views.pages import PreviewOnEdit
|
||||
from wagtail.core.models import GroupPagePermission, Page, PageRevision, Site
|
||||
from wagtail.core.signals import page_published, page_unpublished
|
||||
from wagtail.search.index import SearchField
|
||||
from wagtail.users.models import UserProfile
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ from django.contrib.auth.models import Group
|
|||
from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
|
||||
from wagtail.core.models import Page, PageViewRestriction
|
||||
from wagtail.tests.testapp.models import SimplePage
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.core.models import Page, PageViewRestriction
|
||||
|
||||
|
||||
class TestSetPrivacyView(TestCase, WagtailTestUtils):
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
from bs4 import BeautifulSoup
|
||||
|
||||
from django.conf import settings
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
from django.urls import reverse
|
||||
|
||||
from wagtail.tests.testapp.models import SingleEventPage
|
||||
from wagtail.tests.testapp.rich_text import CustomRichTextArea
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.admin.rich_text import DraftailRichTextArea, HalloRichTextArea, get_rich_text_editor_widget
|
||||
from wagtail.admin.rich_text import (
|
||||
DraftailRichTextArea, HalloRichTextArea, get_rich_text_editor_widget)
|
||||
from wagtail.core.blocks import RichTextBlock
|
||||
from wagtail.core.models import Page, get_page_models
|
||||
from wagtail.core.rich_text import RichText
|
||||
from wagtail.tests.testapp.models import SingleEventPage
|
||||
from wagtail.tests.testapp.rich_text import CustomRichTextArea
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class BaseRichTextEditHandlerTestCase(TestCase):
|
||||
|
|
|
@ -5,9 +5,9 @@ from django.test import TestCase
|
|||
from django.test.client import RequestFactory
|
||||
from django.urls import reverse
|
||||
|
||||
from wagtail.core.models import PAGE_TEMPLATE_VAR, Page, Site
|
||||
from wagtail.tests.testapp.models import BusinessChild, BusinessIndex
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.core.models import PAGE_TEMPLATE_VAR, Page, Site
|
||||
|
||||
|
||||
class TestUserbarTag(TestCase):
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
|
||||
from wagtail.tests.testapp.models import EventPage, SimplePage
|
||||
from wagtail.admin import widgets
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.tests.testapp.models import EventPage, SimplePage
|
||||
|
||||
|
||||
class TestAdminPageChooserWidget(TestCase):
|
||||
|
|
|
@ -10,11 +10,11 @@ from django.urls import reverse, reverse_lazy
|
|||
from django.utils.translation import ugettext_lazy as _
|
||||
from taggit.models import Tag
|
||||
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.admin.menu import MenuItem
|
||||
from wagtail.admin.site_summary import PagesSummaryItem
|
||||
from wagtail.admin.utils import send_mail, user_has_any_page_permission
|
||||
from wagtail.core.models import Page, Site
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestHome(TestCase, WagtailTestUtils):
|
||||
|
|
|
@ -3,12 +3,12 @@ import json
|
|||
from django.http import Http404
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
|
||||
from wagtail.utils.pagination import paginate
|
||||
from wagtail.admin.forms import EmailLinkChooserForm, ExternalLinkChooserForm, SearchForm
|
||||
from wagtail.admin.modal_workflow import render_modal_workflow
|
||||
from wagtail.core import hooks
|
||||
from wagtail.core.models import Page, UserPagePermissionsProxy
|
||||
from wagtail.core.utils import resolve_model_string
|
||||
from wagtail.utils.pagination import paginate
|
||||
|
||||
|
||||
def shared_context(request, extra_context=None):
|
||||
|
|
|
@ -16,13 +16,12 @@ from django.views.decorators.http import require_GET, require_POST
|
|||
from django.views.decorators.vary import vary_on_headers
|
||||
from django.views.generic import View
|
||||
|
||||
from wagtail.utils.pagination import paginate
|
||||
from wagtail.admin import messages, signals
|
||||
from wagtail.admin.forms import CopyForm, SearchForm
|
||||
from wagtail.admin.utils import (
|
||||
send_notification, user_has_any_page_permission, user_passes_test)
|
||||
from wagtail.admin.utils import send_notification, user_has_any_page_permission, user_passes_test
|
||||
from wagtail.core import hooks
|
||||
from wagtail.core.models import Page, PageRevision, UserPagePermissionsProxy
|
||||
from wagtail.utils.pagination import paginate
|
||||
|
||||
|
||||
def get_valid_next_url_from_request(request):
|
||||
|
|
|
@ -2,9 +2,9 @@ from django.contrib.auth.models import Permission
|
|||
from django.urls import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ugettext
|
||||
|
||||
from draftjs_exporter.dom import DOM
|
||||
|
||||
import wagtail.admin.rich_text.editors.draftail.features as draftail_features
|
||||
from wagtail.admin.menu import MenuItem, SubmenuMenuItem, settings_menu
|
||||
from wagtail.admin.navigation import get_explorable_root_page
|
||||
from wagtail.admin.rich_text import (
|
||||
|
@ -12,10 +12,8 @@ from wagtail.admin.rich_text import (
|
|||
from wagtail.admin.rich_text.converters.contentstate import link_entity
|
||||
from wagtail.admin.rich_text.converters.editor_html import LinkTypeRule, WhitelistRule
|
||||
from wagtail.admin.rich_text.converters.html_to_contentstate import (
|
||||
BlockElementHandler, ExternalLinkElementHandler, HorizontalRuleHandler, InlineStyleElementHandler,
|
||||
ListElementHandler, ListItemElementHandler, PageLinkElementHandler
|
||||
)
|
||||
import wagtail.admin.rich_text.editors.draftail.features as draftail_features
|
||||
BlockElementHandler, ExternalLinkElementHandler, HorizontalRuleHandler,
|
||||
InlineStyleElementHandler, ListElementHandler, ListItemElementHandler, PageLinkElementHandler)
|
||||
from wagtail.admin.search import SearchArea
|
||||
from wagtail.admin.utils import user_has_any_page_permission
|
||||
from wagtail.admin.viewsets import viewsets
|
||||
|
|
|
@ -13,10 +13,10 @@ from django.utils.html import format_html
|
|||
from django.utils.translation import ugettext_lazy as _
|
||||
from taggit.forms import TagWidget
|
||||
|
||||
from wagtail.utils.widgets import WidgetWithScript
|
||||
from wagtail.admin.datetimepicker import to_datetimepicker_format
|
||||
from wagtail.core import hooks
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.utils.widgets import WidgetWithScript
|
||||
|
||||
DEFAULT_DATE_FORMAT = '%Y-%m-%d'
|
||||
DEFAULT_DATETIME_FORMAT = '%Y-%m-%d %H:%M'
|
||||
|
|
|
@ -7,9 +7,9 @@ from django.test.utils import override_settings
|
|||
from django.urls import reverse
|
||||
|
||||
from wagtail.api.v2 import signal_handlers
|
||||
from wagtail.core.models import Page, Site
|
||||
from wagtail.tests.demosite import models
|
||||
from wagtail.tests.testapp.models import StreamPage
|
||||
from wagtail.core.models import Page, Site
|
||||
|
||||
|
||||
def get_total_page_count():
|
||||
|
|
|
@ -15,8 +15,6 @@ from wagtail.core.models import Orderable, Page
|
|||
from .forms import FormBuilder, WagtailAdminFormPageForm
|
||||
from .views import SubmissionsListView
|
||||
|
||||
|
||||
|
||||
FORM_FIELD_CHOICES = (
|
||||
('singleline', _('Single line text')),
|
||||
('multiline', _('Multi-line text')),
|
||||
|
|
|
@ -9,7 +9,8 @@ from wagtail.contrib.forms.tests.utils import (
|
|||
make_form_page, make_form_page_with_custom_submission, make_form_page_with_redirect)
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.tests.testapp.models import (
|
||||
CustomFormPageSubmission, ExtendedFormField, FormField, FormPageWithCustomFormBuilder, JadeFormPage)
|
||||
CustomFormPageSubmission, ExtendedFormField, FormField, FormPageWithCustomFormBuilder,
|
||||
JadeFormPage)
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
|
||||
from wagtail.contrib.forms.views import DeleteSubmissionsView, FormPagesListView, get_submissions_list_view
|
||||
from wagtail.contrib.forms.views import (
|
||||
DeleteSubmissionsView, FormPagesListView, get_submissions_list_view)
|
||||
|
||||
app_name = 'wagtailforms'
|
||||
urlpatterns = [
|
||||
|
|
|
@ -3,7 +3,6 @@ from django.contrib.contenttypes.models import ContentType
|
|||
from wagtail.core import hooks
|
||||
from wagtail.core.models import UserPagePermissionsProxy, get_page_models
|
||||
|
||||
|
||||
_FORM_CONTENT_TYPES = None
|
||||
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ from django.test.utils import override_settings
|
|||
from wagtail.contrib.frontend_cache.backends import (
|
||||
BaseBackend, CloudflareBackend, CloudfrontBackend, HTTPBackend)
|
||||
from wagtail.contrib.frontend_cache.utils import get_backends
|
||||
from wagtail.tests.testapp.models import EventIndex
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.tests.testapp.models import EventIndex
|
||||
|
||||
from .utils import (
|
||||
PurgeBatch, purge_page_from_cache, purge_pages_from_cache, purge_url_from_cache,
|
||||
|
|
|
@ -2,9 +2,9 @@ from django.contrib.auth import get_user_model
|
|||
from django.contrib.auth.models import Group, Permission
|
||||
from django.test import TestCase
|
||||
|
||||
from wagtail.core.models import GroupPagePermission, Page
|
||||
from wagtail.tests.testapp.models import BusinessIndex, EventCategory, EventPage
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.core.models import GroupPagePermission, Page
|
||||
|
||||
|
||||
class TestIndexView(TestCase, WagtailTestUtils):
|
||||
|
|
|
@ -3,10 +3,10 @@ from django.contrib.auth import get_user_model
|
|||
from django.contrib.auth.models import Group
|
||||
from django.test import TestCase
|
||||
|
||||
from wagtail.tests.modeladmintest.models import Author, Book, Publisher, Token
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.images.models import Image
|
||||
from wagtail.images.tests.utils import get_test_image_file
|
||||
from wagtail.tests.modeladmintest.models import Author, Book, Publisher, Token
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestBookIndexView(TestCase, WagtailTestUtils):
|
||||
|
|
|
@ -29,8 +29,7 @@ from django.views.generic import TemplateView
|
|||
from django.views.generic.edit import FormView
|
||||
|
||||
from wagtail.admin import messages
|
||||
from wagtail.admin.edit_handlers import (
|
||||
ObjectList, extract_panel_definitions_from_model_class)
|
||||
from wagtail.admin.edit_handlers import ObjectList, extract_panel_definitions_from_model_class
|
||||
|
||||
from .forms import ParentChooserForm
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ from warnings import warn
|
|||
from django.contrib.postgres.search import SearchQuery as PostgresSearchQuery
|
||||
from django.contrib.postgres.search import SearchRank, SearchVector
|
||||
from django.db import DEFAULT_DB_ALIAS, NotSupportedError, connections, transaction
|
||||
from django.db.models import F, Manager, TextField, Value, Q
|
||||
from django.db.models import F, Manager, Q, TextField, Value
|
||||
from django.db.models.constants import LOOKUP_SEP
|
||||
from django.db.models.functions import Cast
|
||||
from django.utils.encoding import force_text
|
||||
|
|
|
@ -8,6 +8,7 @@ from django.db.models.functions import Cast
|
|||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from wagtail.search.index import class_is_indexed
|
||||
|
||||
from .utils import get_descendants_content_types_pks
|
||||
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ from django import forms
|
|||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from wagtail.admin.widgets import AdminPageChooser
|
||||
from wagtail.core.models import Site
|
||||
from wagtail.contrib.redirects.models import Redirect
|
||||
from wagtail.core.models import Site
|
||||
|
||||
|
||||
class RedirectForm(forms.ModelForm):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from wagtail.core.permission_policies import ModelPermissionPolicy
|
||||
from wagtail.contrib.redirects.models import Redirect
|
||||
from wagtail.core.permission_policies import ModelPermissionPolicy
|
||||
|
||||
permission_policy = ModelPermissionPolicy(Redirect)
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
from django.test import TestCase, override_settings
|
||||
from django.urls import reverse
|
||||
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.core.models import Page, Site
|
||||
from wagtail.contrib.redirects import models
|
||||
from wagtail.core.models import Page, Site
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
|
||||
@override_settings(ALLOWED_HOSTS=['testserver', 'localhost', 'test.example.com', 'other.example.com'])
|
||||
|
|
|
@ -3,13 +3,13 @@ from django.urls import reverse
|
|||
from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.vary import vary_on_headers
|
||||
|
||||
from wagtail.utils.pagination import paginate
|
||||
from wagtail.admin import messages
|
||||
from wagtail.admin.forms import SearchForm
|
||||
from wagtail.admin.utils import PermissionPolicyChecker, permission_denied
|
||||
from wagtail.contrib.redirects import models
|
||||
from wagtail.contrib.redirects.forms import RedirectForm
|
||||
from wagtail.contrib.redirects.permissions import permission_policy
|
||||
from wagtail.utils.pagination import paginate
|
||||
|
||||
permission_checker = PermissionPolicyChecker(permission_policy)
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ from django.urls import reverse
|
|||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from wagtail.admin.menu import MenuItem
|
||||
from wagtail.core import hooks
|
||||
from wagtail.contrib.redirects import urls
|
||||
from wagtail.contrib.redirects.permissions import permission_policy
|
||||
from wagtail.core import hooks
|
||||
|
||||
|
||||
@hooks.register('register_admin_urls')
|
||||
|
|
|
@ -2,11 +2,10 @@ import mock
|
|||
from django.test import RequestFactory, TestCase
|
||||
from django.urls.exceptions import NoReverseMatch
|
||||
|
||||
from wagtail.contrib.routable_page.templatetags.wagtailroutablepage_tags import \
|
||||
routablepageurl
|
||||
from wagtail.contrib.routable_page.templatetags.wagtailroutablepage_tags import routablepageurl
|
||||
from wagtail.core.models import Page, Site
|
||||
from wagtail.tests.routablepage.models import (
|
||||
RoutablePageTest, RoutablePageWithOverriddenIndexRouteTest)
|
||||
from wagtail.core.models import Page, Site
|
||||
|
||||
|
||||
class TestRoutablePage(TestCase):
|
||||
|
|
|
@ -2,8 +2,8 @@ from django import forms
|
|||
from django.forms.models import inlineformset_factory
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from wagtail.contrib.search_promotions.models import SearchPromotion
|
||||
from wagtail.admin.widgets import AdminPageChooser
|
||||
from wagtail.contrib.search_promotions.models import SearchPromotion
|
||||
from wagtail.search.models import Query
|
||||
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ from django.urls import reverse
|
|||
from wagtail.contrib.search_promotions.models import SearchPromotion
|
||||
from wagtail.contrib.search_promotions.templatetags.wagtailsearchpromotions_tags import \
|
||||
get_search_promotions
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.search.models import Query
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestSearchPromotions(TestCase):
|
||||
|
|
|
@ -3,13 +3,13 @@ from django.urls import reverse
|
|||
from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.vary import vary_on_headers
|
||||
|
||||
from wagtail.contrib.search_promotions import forms
|
||||
from wagtail.utils.pagination import paginate
|
||||
from wagtail.admin import messages
|
||||
from wagtail.admin.forms import SearchForm
|
||||
from wagtail.admin.utils import any_permission_required, permission_required
|
||||
from wagtail.contrib.search_promotions import forms
|
||||
from wagtail.search import forms as search_forms
|
||||
from wagtail.search.models import Query
|
||||
from wagtail.utils.pagination import paginate
|
||||
|
||||
|
||||
@any_permission_required(
|
||||
|
|
|
@ -3,8 +3,8 @@ from django.contrib.auth.models import Permission
|
|||
from django.urls import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from wagtail.contrib.search_promotions import admin_urls
|
||||
from wagtail.admin.menu import MenuItem
|
||||
from wagtail.contrib.search_promotions import admin_urls
|
||||
from wagtail.core import hooks
|
||||
|
||||
|
||||
|
|
|
@ -4,14 +4,14 @@ from django.test import TestCase, override_settings
|
|||
from django.urls import reverse
|
||||
from django.utils.text import capfirst
|
||||
|
||||
from wagtail.admin.edit_handlers import FieldPanel, ObjectList, TabbedInterface
|
||||
from wagtail.contrib.settings.registry import SettingMenuItem
|
||||
from wagtail.contrib.settings.views import get_setting_edit_handler
|
||||
from wagtail.core import hooks
|
||||
from wagtail.core.models import Page, Site
|
||||
from wagtail.tests.testapp.models import (
|
||||
FileUploadSetting, IconSetting, PanelSettings, TabbedSettings, TestSetting)
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.admin.edit_handlers import FieldPanel, ObjectList, TabbedInterface
|
||||
from wagtail.core import hooks
|
||||
from wagtail.core.models import Page, Site
|
||||
|
||||
|
||||
class TestSettingMenu(TestCase, WagtailTestUtils):
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from django.template import Context, RequestContext, Template, engines
|
||||
from django.test import TestCase
|
||||
|
||||
from wagtail.core.models import Page, Site
|
||||
from wagtail.tests.testapp.models import TestSetting
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.core.models import Page, Site
|
||||
|
||||
|
||||
class TemplateTestCase(TestCase, WagtailTestUtils):
|
||||
|
|
|
@ -4,8 +4,8 @@ import pytz
|
|||
from django.contrib.sites.shortcuts import get_current_site
|
||||
from django.test import RequestFactory, TestCase
|
||||
|
||||
from wagtail.tests.testapp.models import EventIndex, SimplePage
|
||||
from wagtail.core.models import Page, PageViewRestriction, Site
|
||||
from wagtail.tests.testapp.models import EventIndex, SimplePage
|
||||
|
||||
from .sitemap_generator import Sitemap
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ from django.utils.functional import cached_property
|
|||
from wagtail.core.blocks import FieldBlock
|
||||
from wagtail.utils.widgets import WidgetWithScript
|
||||
|
||||
|
||||
DEFAULT_TABLE_OPTIONS = {
|
||||
'minSpareRows': 0,
|
||||
'startRows': 3,
|
||||
|
|
|
@ -29,8 +29,7 @@ from wagtail.core.query import PageQuerySet, TreeQuerySet
|
|||
from wagtail.core.signals import page_published, page_unpublished
|
||||
from wagtail.core.sites import get_site_for_hostname
|
||||
from wagtail.core.url_routing import RouteResult
|
||||
from wagtail.core.utils import (
|
||||
WAGTAIL_APPEND_SLASH, camelcase_to_underscore, resolve_model_string)
|
||||
from wagtail.core.utils import WAGTAIL_APPEND_SLASH, camelcase_to_underscore, resolve_model_string
|
||||
from wagtail.search import index
|
||||
|
||||
logger = logging.getLogger('wagtail.core')
|
||||
|
|
|
@ -4,7 +4,6 @@ Utility classes for rewriting elements of HTML-like strings
|
|||
|
||||
import re
|
||||
|
||||
|
||||
FIND_A_TAG = re.compile(r'<a(\b[^>]*)>')
|
||||
FIND_EMBED_TAG = re.compile(r'<embed(\b[^>]*)/>')
|
||||
FIND_ATTRS = re.compile(r'([\w-]+)\="([^"]*)"')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.test import TestCase
|
||||
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.core import hooks
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
|
||||
def test_hook():
|
||||
|
|
|
@ -3,9 +3,9 @@ from django.template.loader import render_to_string
|
|||
from django.test import TestCase
|
||||
|
||||
from wagtail import __version__
|
||||
from wagtail.tests.testapp.blocks import SectionBlock
|
||||
from wagtail.core import blocks
|
||||
from wagtail.core.models import Page, Site
|
||||
from wagtail.tests.testapp.blocks import SectionBlock
|
||||
|
||||
|
||||
class TestCoreGlobalsAndFilters(TestCase):
|
||||
|
|
|
@ -6,9 +6,9 @@ from django.db import models
|
|||
from django.test import TestCase
|
||||
from django.utils import timezone
|
||||
|
||||
from wagtail.tests.testapp.models import EventPage, SimplePage
|
||||
from wagtail.core.models import Page, PageRevision
|
||||
from wagtail.core.signals import page_published, page_unpublished
|
||||
from wagtail.tests.testapp.models import EventPage, SimplePage
|
||||
|
||||
|
||||
class TestFixTreeCommand(TestCase):
|
||||
|
|
|
@ -12,15 +12,14 @@ from django.test.client import RequestFactory
|
|||
from django.test.utils import override_settings
|
||||
from freezegun import freeze_time
|
||||
|
||||
from wagtail.tests.testapp.models import (
|
||||
AbstractPage, Advert, AlwaysShowInMenusPage, BlogCategory, BlogCategoryBlogPage,
|
||||
BusinessChild, BusinessIndex, BusinessNowherePage, BusinessSubIndex, CustomManager,
|
||||
CustomManagerPage, CustomPageQuerySet, EventIndex, EventPage, GenericSnippetPage,
|
||||
ManyToManyBlogPage, MTIBasePage, MTIChildPage, MyCustomPage, OneToOnePage,
|
||||
PageWithExcludedCopyField, SimplePage, SingleEventPage, SingletonPage,
|
||||
StandardIndex, TaggedPage)
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.core.models import Page, PageManager, Site, get_page_models
|
||||
from wagtail.tests.testapp.models import (
|
||||
AbstractPage, Advert, AlwaysShowInMenusPage, BlogCategory, BlogCategoryBlogPage, BusinessChild,
|
||||
BusinessIndex, BusinessNowherePage, BusinessSubIndex, CustomManager, CustomManagerPage,
|
||||
CustomPageQuerySet, EventIndex, EventPage, GenericSnippetPage, ManyToManyBlogPage, MTIBasePage,
|
||||
MTIChildPage, MyCustomPage, OneToOnePage, PageWithExcludedCopyField, SimplePage,
|
||||
SingleEventPage, SingletonPage, StandardIndex, TaggedPage)
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
|
||||
def get_ct(model):
|
||||
|
|
|
@ -2,8 +2,8 @@ from django.contrib.auth import get_user_model
|
|||
from django.contrib.auth.models import Group
|
||||
from django.test import TestCase
|
||||
|
||||
from wagtail.tests.testapp.models import BusinessSubIndex, EventIndex, EventPage
|
||||
from wagtail.core.models import GroupPagePermission, Page, UserPagePermissionsProxy
|
||||
from wagtail.tests.testapp.models import BusinessSubIndex, EventIndex, EventPage
|
||||
|
||||
|
||||
class TestPagePermission(TestCase):
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.test import TestCase
|
||||
|
||||
from wagtail.tests.testapp.models import EventPage, SimplePage, SingleEventPage
|
||||
from wagtail.core.models import Page, PageViewRestriction, Site
|
||||
from wagtail.core.signals import page_unpublished
|
||||
from wagtail.search.query import MATCH_ALL
|
||||
from wagtail.tests.testapp.models import EventPage, SimplePage, SingleEventPage
|
||||
|
||||
|
||||
class TestPageQuerySet(TestCase):
|
||||
|
|
|
@ -7,13 +7,13 @@ from django.template import Context, Template, engines
|
|||
from django.test import TestCase
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
from wagtail.tests.testapp.models import StreamModel
|
||||
from wagtail.core import blocks
|
||||
from wagtail.core.blocks import StreamValue
|
||||
from wagtail.core.fields import StreamField
|
||||
from wagtail.core.rich_text import RichText
|
||||
from wagtail.images.models import Image
|
||||
from wagtail.images.tests.utils import get_test_image_file
|
||||
from wagtail.tests.testapp.models import StreamModel
|
||||
|
||||
|
||||
class TestLazyStreamField(TestCase):
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from django.test import TestCase
|
||||
|
||||
from wagtail.core.models import PAGE_MODEL_CLASSES, Page, Site
|
||||
from wagtail.tests.testapp.models import (
|
||||
BusinessChild, BusinessIndex, BusinessNowherePage, BusinessSubIndex, EventIndex, EventPage,
|
||||
SimplePage, StreamPage)
|
||||
from wagtail.tests.utils import WagtailPageTests, WagtailTestUtils
|
||||
from wagtail.core.models import PAGE_MODEL_CLASSES, Page, Site
|
||||
|
||||
|
||||
class TestAssertTagInHTML(WagtailTestUtils, TestCase):
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestLoginView(TestCase, WagtailTestUtils):
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
from bs4 import BeautifulSoup
|
||||
from django.test import TestCase
|
||||
|
||||
from wagtail.core.whitelist import (
|
||||
Whitelister, allow_without_attributes, attribute_rule, check_url)
|
||||
from wagtail.core.whitelist import Whitelister, allow_without_attributes, attribute_rule, check_url
|
||||
|
||||
|
||||
class TestCheckUrl(TestCase):
|
||||
|
|
|
@ -4,10 +4,10 @@ from django.http import HttpRequest
|
|||
from django.test import TestCase
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
from wagtail.tests.testapp.models import SimplePage
|
||||
from wagtail.core.models import Page, Site
|
||||
from wagtail.core.templatetags.wagtailcore_tags import richtext
|
||||
from wagtail.core.utils import resolve_model_string
|
||||
from wagtail.tests.testapp.models import SimplePage
|
||||
|
||||
|
||||
class TestPageUrlTags(TestCase):
|
||||
|
|
|
@ -9,10 +9,10 @@ from django.test.utils import override_settings
|
|||
from django.urls import reverse
|
||||
from django.utils.six import b
|
||||
|
||||
from wagtail.tests.testapp.models import EventPage, EventPageRelatedLink
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.core.models import Collection, GroupCollectionPermission, Page
|
||||
from wagtail.documents import models
|
||||
from wagtail.tests.testapp.models import EventPage, EventPageRelatedLink
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestDocumentIndexView(TestCase, WagtailTestUtils):
|
||||
|
|
|
@ -6,8 +6,8 @@ from django.test.utils import override_settings
|
|||
from django.urls import reverse
|
||||
from django.utils.six import b
|
||||
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.documents import models
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
|
||||
@override_settings(_WAGTAILSEARCH_FORCE_AUTO_UPDATE=['elasticsearch'])
|
||||
|
|
|
@ -9,8 +9,8 @@ from django.test import TestCase
|
|||
from django.test.utils import override_settings
|
||||
from django.urls import reverse
|
||||
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.documents import models
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestEditView(TestCase, WagtailTestUtils):
|
||||
|
|
|
@ -3,7 +3,6 @@ import json
|
|||
from django.shortcuts import get_object_or_404, render
|
||||
from django.urls import reverse
|
||||
|
||||
from wagtail.utils.pagination import paginate
|
||||
from wagtail.admin.forms import SearchForm
|
||||
from wagtail.admin.modal_workflow import render_modal_workflow
|
||||
from wagtail.admin.utils import PermissionPolicyChecker
|
||||
|
@ -13,6 +12,7 @@ from wagtail.documents.forms import get_document_form
|
|||
from wagtail.documents.models import get_document_model
|
||||
from wagtail.documents.permissions import permission_policy
|
||||
from wagtail.search import index as search_index
|
||||
from wagtail.utils.pagination import paginate
|
||||
|
||||
permission_checker = PermissionPolicyChecker(permission_policy)
|
||||
|
||||
|
|
|
@ -3,16 +3,15 @@ from django.urls import reverse
|
|||
from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.vary import vary_on_headers
|
||||
|
||||
from wagtail.utils.pagination import paginate
|
||||
from wagtail.admin import messages
|
||||
from wagtail.admin.forms import SearchForm
|
||||
from wagtail.admin.utils import (
|
||||
PermissionPolicyChecker, permission_denied, popular_tags_for_model)
|
||||
from wagtail.admin.utils import PermissionPolicyChecker, permission_denied, popular_tags_for_model
|
||||
from wagtail.core.models import Collection
|
||||
from wagtail.documents.forms import get_document_form
|
||||
from wagtail.documents.models import get_document_model
|
||||
from wagtail.documents.permissions import permission_policy
|
||||
from wagtail.search import index as search_index
|
||||
from wagtail.utils.pagination import paginate
|
||||
|
||||
permission_checker = PermissionPolicyChecker(permission_policy)
|
||||
|
||||
|
|
|
@ -6,12 +6,12 @@ from django.shortcuts import get_object_or_404, redirect
|
|||
from django.template.response import TemplateResponse
|
||||
from django.urls import reverse
|
||||
|
||||
from wagtail.utils import sendfile_streaming_backend
|
||||
from wagtail.utils.sendfile import sendfile
|
||||
from wagtail.core import hooks
|
||||
from wagtail.core.forms import PasswordViewRestrictionForm
|
||||
from wagtail.core.models import CollectionViewRestriction
|
||||
from wagtail.documents.models import document_served, get_document_model
|
||||
from wagtail.utils import sendfile_streaming_backend
|
||||
from wagtail.utils.sendfile import sendfile
|
||||
|
||||
|
||||
def serve(request, document_id, document_filename):
|
||||
|
|
|
@ -5,11 +5,11 @@ from django.template.response import TemplateResponse
|
|||
from django.urls import reverse
|
||||
from django.utils.html import format_html, format_html_join
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ungettext, ugettext
|
||||
from django.utils.translation import ugettext, ungettext
|
||||
|
||||
import wagtail.admin.rich_text.editors.draftail.features as draftail_features
|
||||
from wagtail.admin.menu import MenuItem
|
||||
from wagtail.admin.rich_text import HalloPlugin
|
||||
import wagtail.admin.rich_text.editors.draftail.features as draftail_features
|
||||
from wagtail.admin.search import SearchArea
|
||||
from wagtail.admin.site_summary import SummaryItem
|
||||
from wagtail.core import hooks
|
||||
|
@ -21,8 +21,8 @@ from wagtail.documents.forms import GroupDocumentPermissionFormSet
|
|||
from wagtail.documents.models import get_document_model
|
||||
from wagtail.documents.permissions import permission_policy
|
||||
from wagtail.documents.rich_text import (
|
||||
ContentstateDocumentLinkConversionRule, document_linktype_handler, EditorHTMLDocumentLinkConversionRule
|
||||
)
|
||||
ContentstateDocumentLinkConversionRule, EditorHTMLDocumentLinkConversionRule,
|
||||
document_linktype_handler)
|
||||
|
||||
|
||||
@hooks.register('register_admin_urls')
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import json
|
||||
import re
|
||||
|
||||
from urllib import request as urllib_request
|
||||
from urllib.error import URLError
|
||||
from urllib.parse import urlencode
|
||||
|
|
|
@ -9,14 +9,12 @@ from django.test import TestCase, override_settings
|
|||
from django.urls import reverse
|
||||
from mock import patch
|
||||
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.core import blocks
|
||||
from wagtail.core.rich_text import expand_db_html
|
||||
from wagtail.embeds import oembed_providers
|
||||
from wagtail.embeds.blocks import EmbedBlock, EmbedValue
|
||||
from wagtail.embeds.embeds import get_embed
|
||||
from wagtail.embeds.exceptions import (
|
||||
EmbedNotFoundException, EmbedUnsupportedProviderException)
|
||||
from wagtail.embeds.exceptions import EmbedNotFoundException, EmbedUnsupportedProviderException
|
||||
from wagtail.embeds.finders import get_finders
|
||||
from wagtail.embeds.finders.embedly import EmbedlyFinder as EmbedlyFinder
|
||||
from wagtail.embeds.finders.embedly import AccessDeniedEmbedlyException, EmbedlyException
|
||||
|
@ -24,6 +22,7 @@ from wagtail.embeds.finders.oembed import OEmbedFinder as OEmbedFinder
|
|||
from wagtail.embeds.models import Embed
|
||||
from wagtail.embeds.rich_text import MediaEmbedHandler, media_embedtype_handler
|
||||
from wagtail.embeds.templatetags.wagtailembeds_tags import embed_tag
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
try:
|
||||
import embedly # noqa
|
||||
|
|
|
@ -5,8 +5,7 @@ from django.utils.translation import ugettext as _
|
|||
|
||||
from wagtail.admin.modal_workflow import render_modal_workflow
|
||||
from wagtail.embeds import embeds
|
||||
from wagtail.embeds.exceptions import (
|
||||
EmbedNotFoundException, EmbedUnsupportedProviderException)
|
||||
from wagtail.embeds.exceptions import EmbedNotFoundException, EmbedUnsupportedProviderException
|
||||
from wagtail.embeds.finders.embedly import AccessDeniedEmbedlyException, EmbedlyException
|
||||
from wagtail.embeds.format import embed_to_editor_html
|
||||
from wagtail.embeds.forms import EmbedForm
|
||||
|
|
|
@ -3,13 +3,12 @@ from django.urls import reverse
|
|||
from django.utils.html import format_html
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from wagtail.admin.rich_text import HalloPlugin
|
||||
import wagtail.admin.rich_text.editors.draftail.features as draftail_features
|
||||
from wagtail.admin.rich_text import HalloPlugin
|
||||
from wagtail.core import hooks
|
||||
from wagtail.embeds import urls
|
||||
from wagtail.embeds.rich_text import (
|
||||
ContentstateMediaConversionRule, EditorHTMLEmbedConversionRule, media_embedtype_handler
|
||||
)
|
||||
ContentstateMediaConversionRule, EditorHTMLEmbedConversionRule, media_embedtype_handler)
|
||||
|
||||
|
||||
@hooks.register('register_admin_urls')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from functools import lru_cache
|
||||
import os
|
||||
from functools import lru_cache
|
||||
|
||||
from django.core.checks import Warning, register
|
||||
from willow.image import Image
|
||||
|
|
|
@ -9,7 +9,6 @@ from django.core import checks
|
|||
from django.core.files import File
|
||||
from django.db import models
|
||||
from django.forms.utils import flatatt
|
||||
|
||||
from django.urls import reverse
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.safestring import mark_safe
|
||||
|
|
|
@ -9,9 +9,9 @@ from django.test import TestCase, override_settings
|
|||
from django.urls import reverse
|
||||
from django.utils.http import RFC3986_SUBDELIMS, urlquote
|
||||
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.core.models import Collection, GroupCollectionPermission
|
||||
from wagtail.images.views.serve import generate_signature
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
from .utils import Image, get_test_image_file
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@ from django.test.utils import override_settings
|
|||
from django.urls import reverse
|
||||
from willow.image import Image as WillowImage
|
||||
|
||||
from wagtail.tests.testapp.models import EventPage, EventPageCarouselItem
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.core.models import Collection, GroupCollectionPermission, Page
|
||||
from wagtail.images.models import Rendition, SourceImageIOError
|
||||
from wagtail.images.rect import Rect
|
||||
from wagtail.tests.testapp.models import EventPage, EventPageCarouselItem
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
from .utils import Image, get_test_image_file
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@ from django.urls import reverse
|
|||
from mock import MagicMock
|
||||
from taggit.forms import TagField, TagWidget
|
||||
|
||||
from wagtail.tests.testapp.models import CustomImage, CustomImageFilePath
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.images import get_image_model, get_image_model_string
|
||||
from wagtail.images.fields import WagtailImageField
|
||||
from wagtail.images.formats import Format, get_image_format, register_image_format
|
||||
|
@ -18,6 +16,8 @@ from wagtail.images.forms import get_image_form
|
|||
from wagtail.images.models import Image as WagtailImage
|
||||
from wagtail.images.rect import Rect, Vector
|
||||
from wagtail.images.views.serve import ServeView, generate_signature, verify_signature
|
||||
from wagtail.tests.testapp.models import CustomImage, CustomImageFilePath
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
from .utils import Image, get_test_image_file
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
|
||||
from wagtail.tests import dummy_sendfile_backend
|
||||
from wagtail.images.views.serve import SendFileView, ServeView
|
||||
from wagtail.tests import dummy_sendfile_backend
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^actions/serve/(.*)/(\d*)/(.*)/[^/]*', ServeView.as_view(action='serve'), name='wagtailimages_serve_action_serve'),
|
||||
|
|
|
@ -3,7 +3,6 @@ import json
|
|||
from django.shortcuts import get_object_or_404, render
|
||||
from django.urls import reverse
|
||||
|
||||
from wagtail.utils.pagination import paginate
|
||||
from wagtail.admin.forms import SearchForm
|
||||
from wagtail.admin.modal_workflow import render_modal_workflow
|
||||
from wagtail.admin.utils import PermissionPolicyChecker, popular_tags_for_model
|
||||
|
@ -14,6 +13,7 @@ from wagtail.images.formats import get_image_format
|
|||
from wagtail.images.forms import ImageInsertionForm, get_image_form
|
||||
from wagtail.images.permissions import permission_policy
|
||||
from wagtail.search import index as search_index
|
||||
from wagtail.utils.pagination import paginate
|
||||
|
||||
permission_checker = PermissionPolicyChecker(permission_policy)
|
||||
|
||||
|
|
|
@ -7,11 +7,9 @@ from django.urls.exceptions import NoReverseMatch
|
|||
from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.vary import vary_on_headers
|
||||
|
||||
from wagtail.utils.pagination import paginate
|
||||
from wagtail.admin import messages
|
||||
from wagtail.admin.forms import SearchForm
|
||||
from wagtail.admin.utils import (
|
||||
PermissionPolicyChecker, permission_denied, popular_tags_for_model)
|
||||
from wagtail.admin.utils import PermissionPolicyChecker, permission_denied, popular_tags_for_model
|
||||
from wagtail.core.models import Collection, Site
|
||||
from wagtail.images import get_image_model
|
||||
from wagtail.images.exceptions import InvalidFilterSpecError
|
||||
|
@ -20,6 +18,7 @@ from wagtail.images.models import Filter
|
|||
from wagtail.images.permissions import permission_policy
|
||||
from wagtail.images.views.serve import generate_signature
|
||||
from wagtail.search import index as search_index
|
||||
from wagtail.utils.pagination import paginate
|
||||
|
||||
permission_checker = PermissionPolicyChecker(permission_policy)
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@ from django.utils.decorators import classonlymethod
|
|||
from django.utils.encoding import force_text
|
||||
from django.views.generic import View
|
||||
|
||||
from wagtail.utils.sendfile import sendfile
|
||||
from wagtail.images import get_image_model
|
||||
from wagtail.images.exceptions import InvalidFilterSpecError
|
||||
from wagtail.images.models import SourceImageIOError
|
||||
from wagtail.utils.sendfile import sendfile
|
||||
|
||||
|
||||
def generate_signature(image_id, filter_spec, key=None):
|
||||
|
|
|
@ -3,11 +3,11 @@ from django.contrib.staticfiles.templatetags.staticfiles import static
|
|||
from django.urls import reverse
|
||||
from django.utils.html import format_html, format_html_join
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ungettext, ugettext
|
||||
from django.utils.translation import ugettext, ungettext
|
||||
|
||||
import wagtail.admin.rich_text.editors.draftail.features as draftail_features
|
||||
from wagtail.admin.menu import MenuItem
|
||||
from wagtail.admin.rich_text import HalloPlugin
|
||||
import wagtail.admin.rich_text.editors.draftail.features as draftail_features
|
||||
from wagtail.admin.search import SearchArea
|
||||
from wagtail.admin.site_summary import SummaryItem
|
||||
from wagtail.core import hooks
|
||||
|
@ -16,8 +16,7 @@ from wagtail.images.api.admin.endpoints import ImagesAdminAPIEndpoint
|
|||
from wagtail.images.forms import GroupImagePermissionFormSet
|
||||
from wagtail.images.permissions import permission_policy
|
||||
from wagtail.images.rich_text import (
|
||||
ContentstateImageConversionRule, EditorHTMLImageConversionRule, image_embedtype_handler
|
||||
)
|
||||
ContentstateImageConversionRule, EditorHTMLImageConversionRule, image_embedtype_handler)
|
||||
|
||||
|
||||
@hooks.register('register_admin_urls')
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
from warnings import warn
|
||||
|
||||
import warnings
|
||||
from warnings import warn
|
||||
|
||||
from django.db.models.lookups import Lookup
|
||||
from django.db.models.query import QuerySet
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import copy
|
||||
import json
|
||||
from urllib.parse import urlparse
|
||||
import warnings
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from django.db import DEFAULT_DB_ALIAS, models
|
||||
from django.db.models.sql import Query
|
||||
|
@ -10,13 +10,13 @@ from django.utils.crypto import get_random_string
|
|||
from elasticsearch import Elasticsearch, NotFoundError
|
||||
from elasticsearch.helpers import bulk
|
||||
|
||||
from wagtail.utils.deprecation import RemovedInWagtail22Warning
|
||||
from wagtail.utils.utils import deep_update
|
||||
from wagtail.search.backends.base import (
|
||||
BaseSearchBackend, BaseSearchQueryCompiler, BaseSearchResults)
|
||||
from wagtail.search.index import (
|
||||
FilterField, Indexed, RelatedFields, SearchField, class_is_indexed)
|
||||
from wagtail.search.query import MatchAll, Term, Prefix, Fuzzy, And, Or, Not, PlainText, Filter, Boost
|
||||
from wagtail.search.index import FilterField, Indexed, RelatedFields, SearchField, class_is_indexed
|
||||
from wagtail.search.query import (
|
||||
And, Boost, Filter, Fuzzy, MatchAll, Not, Or, PlainText, Prefix, Term)
|
||||
from wagtail.utils.deprecation import RemovedInWagtail22Warning
|
||||
from wagtail.utils.utils import deep_update
|
||||
|
||||
|
||||
def get_model_root(model):
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from wagtail.search.backends import get_search_backend
|
||||
|
||||
|
||||
|
||||
class SearchableQuerySetMixin:
|
||||
def search(self, query, fields=None,
|
||||
operator=None, order_by_relevance=True, backend='default'):
|
||||
|
|
|
@ -3,9 +3,9 @@ from io import StringIO
|
|||
|
||||
from django.core import management
|
||||
|
||||
from wagtail.tests.search import models
|
||||
from wagtail.search.query import MATCH_ALL
|
||||
from wagtail.search.tests.test_backends import BackendTests
|
||||
from wagtail.tests.search import models
|
||||
|
||||
|
||||
class ElasticsearchCommonSearchBackendTests(BackendTests):
|
||||
|
|
|
@ -9,13 +9,13 @@ from django.core import management
|
|||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
|
||||
from wagtail.tests.search import models
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.search.backends import (
|
||||
InvalidSearchBackendError, get_search_backend, get_search_backends)
|
||||
from wagtail.search.backends.base import FieldError
|
||||
from wagtail.search.backends.db import DatabaseSearchBackend
|
||||
from wagtail.search.query import MATCH_ALL, And, Boost, Filter, Not, Or, PlainText, Term
|
||||
from wagtail.tests.search import models
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class BackendTests(WagtailTestUtils):
|
||||
|
|
|
@ -7,10 +7,9 @@ from django.db.models import Q
|
|||
from django.test import TestCase
|
||||
from elasticsearch.serializer import JSONSerializer
|
||||
|
||||
from wagtail.tests.search import models
|
||||
from wagtail.search.backends.elasticsearch2 import (
|
||||
Elasticsearch2SearchBackend, get_model_root)
|
||||
from wagtail.search.backends.elasticsearch2 import Elasticsearch2SearchBackend, get_model_root
|
||||
from wagtail.search.query import MATCH_ALL
|
||||
from wagtail.tests.search import models
|
||||
|
||||
from .elasticsearch_common_tests import ElasticsearchCommonSearchBackendTests
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@ from django.db.models import Q
|
|||
from django.test import TestCase
|
||||
from elasticsearch.serializer import JSONSerializer
|
||||
|
||||
from wagtail.tests.search import models
|
||||
from wagtail.search.backends.elasticsearch5 import Elasticsearch5SearchBackend
|
||||
from wagtail.search.query import MATCH_ALL
|
||||
from wagtail.tests.search import models
|
||||
|
||||
from .elasticsearch_common_tests import ElasticsearchCommonSearchBackendTests
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ from django.core import paginator
|
|||
from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
|
||||
from wagtail.tests.testapp.models import EventPage
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.search.models import Query
|
||||
from wagtail.tests.testapp.models import EventPage
|
||||
|
||||
|
||||
class TestSearchView(TestCase):
|
||||
|
|
|
@ -3,11 +3,11 @@ from datetime import date
|
|||
import mock
|
||||
from django.test import TestCase, override_settings
|
||||
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.search import index
|
||||
from wagtail.tests.search import models
|
||||
from wagtail.tests.testapp.models import SimplePage
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.search import index
|
||||
|
||||
|
||||
class TestGetIndexedInstance(TestCase):
|
||||
|
|
|
@ -3,8 +3,8 @@ from contextlib import contextmanager
|
|||
from django.core import checks
|
||||
from django.test import TestCase
|
||||
|
||||
from wagtail.tests.search import models
|
||||
from wagtail.search import index
|
||||
from wagtail.tests.search import models
|
||||
|
||||
|
||||
@contextmanager
|
||||
|
|
|
@ -5,9 +5,9 @@ from django.core import management
|
|||
from django.test import SimpleTestCase, TestCase
|
||||
|
||||
from wagtail.contrib.search_promotions.models import SearchPromotion
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.search import models
|
||||
from wagtail.search.utils import normalise_query_string, separate_filters_from_query
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestHitCounter(TestCase):
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from django.test import TestCase
|
||||
|
||||
from wagtail.search import index
|
||||
from wagtail.tests.search.models import Book, Novel
|
||||
from wagtail.tests.testapp.models import Advert, ManyToManyBlogPage
|
||||
from wagtail.search import index
|
||||
|
||||
|
||||
class TestSelectOnQuerySet(TestCase):
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from django.shortcuts import render
|
||||
|
||||
from wagtail.utils.pagination import paginate
|
||||
from wagtail.admin.forms import SearchForm
|
||||
from wagtail.admin.modal_workflow import render_modal_workflow
|
||||
from wagtail.search import models
|
||||
from wagtail.search.utils import normalise_query_string
|
||||
from wagtail.utils.pagination import paginate
|
||||
|
||||
|
||||
def chooser(request, get_results=False):
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Ładowanie…
Reference in New Issue