wagtail 7.1.2__py3-none-any.whl → 7.2rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wagtail/__init__.py +1 -1
- wagtail/actions/copy_page.py +1 -1
- wagtail/actions/create_alias.py +1 -1
- wagtail/actions/delete_page.py +1 -1
- wagtail/actions/publish_page_revision.py +1 -1
- wagtail/actions/publish_revision.py +1 -1
- wagtail/actions/revert_to_page_revision.py +1 -1
- wagtail/actions/unpublish.py +1 -1
- wagtail/actions/unpublish_page.py +1 -1
- wagtail/admin/auth.py +3 -1
- wagtail/admin/checks.py +2 -2
- wagtail/admin/filters.py +28 -1
- wagtail/admin/forms/collections.py +1 -1
- wagtail/admin/forms/comments.py +1 -1
- wagtail/admin/forms/models.py +1 -1
- wagtail/admin/forms/pages.py +1 -1
- wagtail/admin/forms/tags.py +1 -1
- wagtail/admin/locale/cs/LC_MESSAGES/django.mo +0 -0
- wagtail/admin/locale/cs/LC_MESSAGES/django.po +25 -1
- wagtail/admin/locale/en/LC_MESSAGES/django.po +278 -192
- wagtail/admin/locale/en/LC_MESSAGES/djangojs.po +29 -15
- wagtail/admin/locale/it/LC_MESSAGES/django.mo +0 -0
- wagtail/admin/locale/it/LC_MESSAGES/django.po +3 -2
- wagtail/admin/locale/nl/LC_MESSAGES/django.mo +0 -0
- wagtail/admin/locale/nl/LC_MESSAGES/django.po +57 -3
- wagtail/admin/locale/nl/LC_MESSAGES/djangojs.mo +0 -0
- wagtail/admin/locale/nl/LC_MESSAGES/djangojs.po +8 -2
- wagtail/admin/locale/ru/LC_MESSAGES/django.mo +0 -0
- wagtail/admin/locale/ru/LC_MESSAGES/django.po +58 -1
- wagtail/admin/locale/tr/LC_MESSAGES/django.mo +0 -0
- wagtail/admin/locale/tr/LC_MESSAGES/django.po +3 -2
- wagtail/admin/static/wagtailadmin/css/core.css +1 -1
- wagtail/admin/static/wagtailadmin/js/bulk-actions.js +1 -1
- wagtail/admin/static/wagtailadmin/js/chooser-modal.js +1 -1
- wagtail/admin/static/wagtailadmin/js/chooser-widget-telepath.js +1 -1
- wagtail/admin/static/wagtailadmin/js/chooser-widget.js +1 -1
- wagtail/admin/static/wagtailadmin/js/comments.js +1 -1
- wagtail/admin/static/wagtailadmin/js/core.js +1 -1
- wagtail/admin/static/wagtailadmin/js/core.js.LICENSE.txt +2 -2
- wagtail/admin/static/wagtailadmin/js/date-time-chooser.js +1 -1
- wagtail/admin/static/wagtailadmin/js/draftail.js +1 -1
- wagtail/admin/static/wagtailadmin/js/filtered-select.js +1 -1
- wagtail/admin/static/wagtailadmin/js/icons.js +1 -1
- wagtail/admin/static/wagtailadmin/js/modal-workflow.js +1 -1
- wagtail/admin/static/wagtailadmin/js/page-chooser-modal.js +1 -1
- wagtail/admin/static/wagtailadmin/js/page-chooser-telepath.js +1 -1
- wagtail/admin/static/wagtailadmin/js/page-chooser.js +1 -1
- wagtail/admin/static/wagtailadmin/js/privacy-switch.js +1 -1
- wagtail/admin/static/wagtailadmin/js/sidebar.js +1 -1
- wagtail/admin/static/wagtailadmin/js/task-chooser-modal.js +1 -1
- wagtail/admin/static/wagtailadmin/js/task-chooser.js +1 -1
- wagtail/admin/static/wagtailadmin/js/telepath/blocks.js +1 -1
- wagtail/admin/static/wagtailadmin/js/telepath/telepath.js +1 -1
- wagtail/admin/static/wagtailadmin/js/telepath/widgets.js +1 -1
- wagtail/admin/static/wagtailadmin/js/userbar.js +1 -1
- wagtail/admin/static/wagtailadmin/js/userbar.js.LICENSE.txt +2 -2
- wagtail/admin/static/wagtailadmin/js/vendor/bootstrap-modal.js +1 -1
- wagtail/admin/static/wagtailadmin/js/vendor/bootstrap-transition.js +1 -1
- wagtail/admin/static/wagtailadmin/js/vendor/jquery-3.6.0.min.js +1 -1
- wagtail/admin/static/wagtailadmin/js/vendor/jquery-ui-1.13.2.min.js +1 -1
- wagtail/admin/static/wagtailadmin/js/vendor/jquery.datetimepicker.js +1 -1
- wagtail/admin/static/wagtailadmin/js/vendor/jquery.fileupload-process.js +1 -1
- wagtail/admin/static/wagtailadmin/js/vendor/jquery.fileupload.js +1 -1
- wagtail/admin/static/wagtailadmin/js/vendor/jquery.iframe-transport.js +1 -1
- wagtail/admin/static/wagtailadmin/js/vendor/tag-it.js +1 -1
- wagtail/admin/static/wagtailadmin/js/vendor.js +1 -1
- wagtail/admin/static/wagtailadmin/js/vendor.js.LICENSE.txt +1 -1
- wagtail/admin/static/wagtailadmin/js/wagtailadmin.js +1 -1
- wagtail/admin/static/wagtailadmin/js/workflow-action.js +1 -1
- wagtail/admin/templates/wagtailadmin/account/account.html +2 -0
- wagtail/admin/templates/wagtailadmin/base.html +14 -0
- wagtail/admin/templates/wagtailadmin/generic/chooser/chooser.html +2 -1
- wagtail/admin/templates/wagtailadmin/generic/chooser/creation_form.html +2 -1
- wagtail/admin/templates/wagtailadmin/panels/multi_field_panel_child.html +1 -1
- wagtail/admin/templates/wagtailadmin/panels/object_list.html +1 -1
- wagtail/admin/templates/wagtailadmin/panels/tabbed_interface.html +3 -2
- wagtail/admin/templates/wagtailadmin/shared/formatted_field.html +1 -1
- wagtail/admin/templates/wagtailadmin/shared/forms/single_checkbox.html +1 -1
- wagtail/admin/templates/wagtailadmin/shared/keyboard_shortcuts_dialog.html +19 -0
- wagtail/admin/templates/wagtailadmin/shared/panel.html +1 -1
- wagtail/admin/templates/wagtailadmin/shared/set_privacy.html +15 -0
- wagtail/admin/templates/wagtailadmin/shared/side_panels/checks.html +28 -1
- wagtail/admin/templates/wagtailadmin/shared/workflow_history/detail.html +2 -2
- wagtail/admin/templates/wagtailadmin/{pages/listing/_ordering_header.html → tables/ordering_header.html} +2 -2
- wagtail/admin/templates/wagtailadmin/tables/title_cell.html +1 -1
- wagtail/admin/templates/wagtailadmin/widgets/{daterange_input.html → range_input.html} +1 -1
- wagtail/admin/templates/wagtailadmin/workflows/task_chooser/chooser.html +4 -2
- wagtail/admin/templatetags/wagtailadmin_tags.py +41 -22
- wagtail/admin/tests/api/test_pages.py +7 -7
- wagtail/admin/tests/api/test_renderer_classes.py +16 -0
- wagtail/admin/tests/pages/test_create_page.py +34 -2
- wagtail/admin/tests/pages/test_edit_page.py +128 -14
- wagtail/admin/tests/pages/test_explorer_view.py +34 -7
- wagtail/admin/tests/pages/test_reorder_page.py +11 -0
- wagtail/admin/tests/test_collections_views.py +12 -0
- wagtail/admin/tests/test_edit_handlers.py +3 -3
- wagtail/admin/tests/test_filters.py +2 -2
- wagtail/admin/tests/test_keyboard_shortcuts.py +52 -2
- wagtail/admin/tests/test_menu.py +0 -2
- wagtail/admin/tests/test_privacy.py +16 -16
- wagtail/admin/tests/test_templatetags.py +137 -0
- wagtail/admin/tests/test_workflows.py +34 -0
- wagtail/admin/tests/viewsets/test_model_viewset.py +322 -0
- wagtail/admin/ui/tables/orderable.py +73 -0
- wagtail/admin/ui/tables/pages.py +3 -13
- wagtail/admin/views/collection_privacy.py +6 -2
- wagtail/admin/views/generic/__init__.py +1 -0
- wagtail/admin/views/generic/mixins.py +20 -2
- wagtail/admin/views/generic/models.py +67 -1
- wagtail/admin/views/generic/ordering.py +79 -0
- wagtail/admin/views/home.py +3 -3
- wagtail/admin/views/page_privacy.py +5 -2
- wagtail/admin/views/pages/create.py +1 -1
- wagtail/admin/views/pages/edit.py +2 -2
- wagtail/admin/views/pages/listing.py +7 -42
- wagtail/admin/views/pages/move.py +1 -1
- wagtail/admin/views/pages/ordering.py +1 -1
- wagtail/admin/viewsets/base.py +1 -1
- wagtail/admin/viewsets/model.py +49 -1
- wagtail/admin/wagtail_hooks.py +2 -1
- wagtail/admin/widgets/slug.py +10 -10
- wagtail/api/v2/serializers.py +1 -1
- wagtail/api/v2/tests/test_renderer_classes.py +32 -0
- wagtail/apps.py +2 -0
- wagtail/bin/wagtail.py +1 -1
- wagtail/contrib/forms/locale/en/LC_MESSAGES/django.po +14 -14
- wagtail/contrib/forms/locale/nl/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/forms/locale/nl/LC_MESSAGES/django.po +19 -2
- wagtail/contrib/forms/locale/ru/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/forms/locale/ru/LC_MESSAGES/django.po +18 -1
- wagtail/contrib/frontend_cache/tests.py +4 -2
- wagtail/contrib/redirects/locale/en/LC_MESSAGES/django.po +4 -4
- wagtail/contrib/redirects/tests/test_tmp_storages.py +20 -0
- wagtail/contrib/redirects/tmp_storages.py +1 -1
- wagtail/contrib/redirects/views.py +3 -3
- wagtail/contrib/search_promotions/locale/en/LC_MESSAGES/django.po +3 -3
- wagtail/contrib/search_promotions/locale/tr/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/search_promotions/locale/tr/LC_MESSAGES/django.po +43 -3
- wagtail/contrib/search_promotions/static/wagtailsearchpromotions/js/query-chooser-modal.js +1 -1
- wagtail/contrib/search_promotions/views/settings.py +2 -2
- wagtail/contrib/settings/locale/cs/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/settings/locale/cs/LC_MESSAGES/django.po +6 -1
- wagtail/contrib/settings/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/contrib/settings/locale/nl/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/settings/locale/nl/LC_MESSAGES/django.po +6 -2
- wagtail/contrib/settings/locale/ru/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/settings/locale/ru/LC_MESSAGES/django.po +6 -1
- wagtail/contrib/settings/tests/site_specific/test_admin.py +40 -6
- wagtail/contrib/simple_translation/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/contrib/styleguide/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/contrib/styleguide/templates/wagtailstyleguide/base.html +5 -5
- wagtail/contrib/table_block/blocks.py +1 -0
- wagtail/contrib/table_block/locale/en/LC_MESSAGES/django.po +5 -1
- wagtail/contrib/table_block/static/table_block/js/table.js +1 -1
- wagtail/contrib/typed_table_block/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/contrib/typed_table_block/static/typed_table_block/js/typed_table_block.js +1 -1
- wagtail/coreutils.py +5 -5
- wagtail/documents/forms.py +18 -1
- wagtail/documents/locale/en/LC_MESSAGES/django.po +10 -10
- wagtail/documents/locale/nl/LC_MESSAGES/django.mo +0 -0
- wagtail/documents/locale/nl/LC_MESSAGES/django.po +9 -0
- wagtail/documents/locale/ru/LC_MESSAGES/django.mo +0 -0
- wagtail/documents/locale/ru/LC_MESSAGES/django.po +9 -0
- wagtail/documents/models.py +1 -1
- wagtail/documents/static/wagtaildocs/js/add-multiple.js +1 -1
- wagtail/documents/static/wagtaildocs/js/document-chooser-modal.js +1 -1
- wagtail/documents/static/wagtaildocs/js/document-chooser-telepath.js +1 -1
- wagtail/documents/static/wagtaildocs/js/document-chooser.js +1 -1
- wagtail/documents/templates/wagtaildocs/documents/add.html +0 -34
- wagtail/documents/tests/test_admin_views.py +132 -26
- wagtail/documents/tests/test_collection_privacy.py +18 -4
- wagtail/documents/tests/test_form_overrides.py +1 -1
- wagtail/documents/tests/test_search.py +21 -8
- wagtail/documents/views/documents.py +1 -1
- wagtail/embeds/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/embeds/static/wagtailembeds/js/embed-chooser-modal.js +1 -1
- wagtail/images/forms.py +16 -1
- wagtail/images/locale/cs/LC_MESSAGES/django.mo +0 -0
- wagtail/images/locale/cs/LC_MESSAGES/django.po +12 -1
- wagtail/images/locale/en/LC_MESSAGES/django.po +57 -46
- wagtail/images/locale/nl/LC_MESSAGES/django.mo +0 -0
- wagtail/images/locale/nl/LC_MESSAGES/django.po +37 -14
- wagtail/images/locale/ru/LC_MESSAGES/django.mo +0 -0
- wagtail/images/locale/ru/LC_MESSAGES/django.po +20 -1
- wagtail/images/models.py +1 -1
- wagtail/images/static/wagtailimages/js/add-multiple.js +1 -1
- wagtail/images/static/wagtailimages/js/focal-point-chooser.js +1 -1
- wagtail/images/static/wagtailimages/js/image-block.js +1 -1
- wagtail/images/static/wagtailimages/js/image-chooser-modal.js +1 -1
- wagtail/images/static/wagtailimages/js/image-chooser-telepath.js +1 -1
- wagtail/images/static/wagtailimages/js/image-chooser.js +1 -1
- wagtail/images/static/wagtailimages/js/image-url-generator.js +1 -1
- wagtail/images/static/wagtailimages/js/vendor/jquery.Jcrop.min.js +1 -1
- wagtail/images/static/wagtailimages/js/vendor/jquery.fileupload-image.js +1 -1
- wagtail/images/static/wagtailimages/js/vendor/jquery.fileupload-validate.js +1 -1
- wagtail/images/static/wagtailimages/js/vendor/load-image.min.js +1 -1
- wagtail/images/templates/wagtailimages/chooser/chooser.html +22 -13
- wagtail/images/templates/wagtailimages/chooser/image_preview_column_cell.html +10 -0
- wagtail/images/templates/wagtailimages/chooser/results.html +24 -20
- wagtail/images/templates/wagtailimages/chooser/title_column_cell.html +15 -0
- wagtail/images/templates/wagtailimages/images/add.html +0 -34
- wagtail/images/templates/wagtailimages/images/index.html +3 -3
- wagtail/images/templates/wagtailimages/images/index_results.html +1 -1
- wagtail/images/templates/wagtailimages/images/layout_toggle_button.html +8 -7
- wagtail/images/templatetags/wagtailimages_tags.py +2 -2
- wagtail/images/tests/test_admin_views.py +87 -0
- wagtail/images/tests/test_form_overrides.py +1 -1
- wagtail/images/tests/test_models.py +48 -9
- wagtail/images/views/chooser.py +66 -2
- wagtail/locale/en/LC_MESSAGES/django.po +55 -55
- wagtail/locale/is_IS/LC_MESSAGES/django.mo +0 -0
- wagtail/locale/is_IS/LC_MESSAGES/django.po +3 -3
- wagtail/locale/nl/LC_MESSAGES/django.mo +0 -0
- wagtail/locale/nl/LC_MESSAGES/django.po +11 -2
- wagtail/locale/ru/LC_MESSAGES/django.mo +0 -0
- wagtail/locale/ru/LC_MESSAGES/django.po +11 -1
- wagtail/locales/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/locales/locale/nl/LC_MESSAGES/django.mo +0 -0
- wagtail/locales/locale/nl/LC_MESSAGES/django.po +12 -1
- wagtail/locales/locale/ru/LC_MESSAGES/django.mo +0 -0
- wagtail/locales/locale/ru/LC_MESSAGES/django.po +10 -1
- wagtail/locales/views.py +2 -2
- wagtail/models/orderable.py +10 -0
- wagtail/models/pages.py +9 -11
- wagtail/models/sites.py +1 -1
- wagtail/models/workflows.py +8 -5
- wagtail/project_template/home/tests.py +6 -7
- wagtail/project_template/project_name/settings/base.py +9 -9
- wagtail/project_template/requirements.txt +1 -1
- wagtail/query.py +7 -2
- wagtail/rich_text/rewriters.py +1 -1
- wagtail/search/apps.py +4 -49
- wagtail/search/backends/__init__.py +1 -113
- wagtail/search/backends/base.py +1 -547
- wagtail/search/backends/database/__init__.py +1 -50
- wagtail/search/backends/database/fallback.py +1 -253
- wagtail/search/backends/database/mysql/mysql.py +1 -700
- wagtail/search/backends/database/mysql/query.py +1 -258
- wagtail/search/backends/database/postgres/postgres.py +1 -749
- wagtail/search/backends/database/postgres/query.py +1 -83
- wagtail/search/backends/database/postgres/weights.py +1 -63
- wagtail/search/backends/database/sqlite/query.py +1 -294
- wagtail/search/backends/database/sqlite/sqlite.py +1 -719
- wagtail/search/backends/database/sqlite/utils.py +1 -35
- wagtail/search/backends/deprecation.py +45 -0
- wagtail/search/backends/elasticsearch7.py +18 -1260
- wagtail/search/backends/elasticsearch8.py +21 -96
- wagtail/search/backends/elasticsearch9.py +35 -0
- wagtail/search/backends/opensearch2.py +35 -0
- wagtail/search/backends/opensearch3.py +35 -0
- wagtail/search/index.py +1 -358
- wagtail/search/locale/en/LC_MESSAGES/django.po +2 -10
- wagtail/search/management/commands/update_index.py +1 -205
- wagtail/search/management/commands/wagtail_update_index.py +1 -4
- wagtail/search/models.py +32 -158
- wagtail/search/query.py +1 -114
- wagtail/search/queryset.py +1 -43
- wagtail/search/signal_handlers.py +1 -24
- wagtail/search/tasks.py +1 -10
- wagtail/search/tests/test_elasticsearch.py +22 -0
- wagtail/search/utils.py +1 -206
- wagtail/sites/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/snippets/locale/en/LC_MESSAGES/django.po +3 -3
- wagtail/snippets/locale/ru/LC_MESSAGES/django.mo +0 -0
- wagtail/snippets/locale/ru/LC_MESSAGES/django.po +8 -1
- wagtail/snippets/locale/tr/LC_MESSAGES/django.mo +0 -0
- wagtail/snippets/locale/tr/LC_MESSAGES/django.po +8 -1
- wagtail/snippets/static/wagtailsnippets/js/snippet-chooser-telepath.js +1 -1
- wagtail/snippets/static/wagtailsnippets/js/snippet-chooser.js +1 -1
- wagtail/snippets/tests/test_reordering.py +319 -0
- wagtail/snippets/tests/test_snippets.py +65 -12
- wagtail/snippets/views/snippets.py +16 -0
- wagtail/test/numberformat.py +30 -0
- wagtail/test/settings.py +35 -12
- wagtail/test/testapp/fields.py +12 -0
- wagtail/test/testapp/migrations/0056_commentablejsonpage.py +50 -0
- wagtail/test/testapp/migrations/0057_featurecompletetoy_sort_order.py +23 -0
- wagtail/test/testapp/migrations/0058_customlocktask.py +31 -0
- wagtail/test/testapp/models.py +27 -0
- wagtail/test/testapp/views.py +3 -1
- wagtail/test/utils/page_tests.py +17 -17
- wagtail/test/utils/template_tests.py +4 -6
- wagtail/test/utils/wagtail_tests.py +1 -2
- wagtail/tests/test_page_model.py +15 -0
- wagtail/{search/tests → tests}/test_page_search.py +29 -2
- wagtail/tests/test_search_fields.py +69 -0
- wagtail/tests/test_tests.py +62 -6
- wagtail/tests/test_workflow.py +25 -1
- wagtail/users/locale/cs/LC_MESSAGES/django.mo +0 -0
- wagtail/users/locale/cs/LC_MESSAGES/django.po +3 -0
- wagtail/users/locale/en/LC_MESSAGES/django.po +2 -2
- wagtail/users/locale/nl/LC_MESSAGES/django.mo +0 -0
- wagtail/users/locale/nl/LC_MESSAGES/django.po +6 -3
- wagtail/users/locale/ru/LC_MESSAGES/django.mo +0 -0
- wagtail/users/locale/ru/LC_MESSAGES/django.po +5 -1
- wagtail/users/locale/tr/LC_MESSAGES/django.mo +0 -0
- wagtail/users/locale/tr/LC_MESSAGES/django.po +78 -4
- wagtail/users/templates/wagtailusers/users/create.html +2 -0
- wagtail/users/templates/wagtailusers/users/edit.html +2 -0
- wagtail/users/tests/test_admin_views.py +4 -0
- wagtail/users/views/users.py +1 -1
- {wagtail-7.1.2.dist-info → wagtail-7.2rc1.dist-info}/METADATA +7 -6
- {wagtail-7.1.2.dist-info → wagtail-7.2rc1.dist-info}/RECORD +309 -315
- wagtail/admin/templates/wagtailadmin/collection_privacy/set_privacy.html +0 -13
- wagtail/admin/templates/wagtailadmin/page_privacy/set_privacy.html +0 -13
- wagtail/search/tests/__init__.py +0 -0
- wagtail/search/tests/elasticsearch_common_tests.py +0 -251
- wagtail/search/tests/test_backends.py +0 -1215
- wagtail/search/tests/test_db_backend.py +0 -62
- wagtail/search/tests/test_elasticsearch7_backend.py +0 -1452
- wagtail/search/tests/test_elasticsearch8_backend.py +0 -15
- wagtail/search/tests/test_index_functions.py +0 -256
- wagtail/search/tests/test_indexed_class.py +0 -157
- wagtail/search/tests/test_mysql_backend.py +0 -192
- wagtail/search/tests/test_postgres_backend.py +0 -210
- wagtail/search/tests/test_queries.py +0 -332
- wagtail/search/tests/test_related_fields.py +0 -102
- wagtail/search/tests/test_sqlite_backend.py +0 -52
- wagtail/test/search/__init__.py +0 -0
- wagtail/test/search/apps.py +0 -9
- wagtail/test/search/fixtures/search.json +0 -545
- wagtail/test/search/migrations/0001_initial.py +0 -146
- wagtail/test/search/migrations/0002_bookunindexed.py +0 -43
- wagtail/test/search/migrations/0003_book_summary.py +0 -18
- wagtail/test/search/migrations/__init__.py +0 -0
- wagtail/test/search/models.py +0 -137
- /wagtail/admin/templates/wagtailadmin/{pages/listing/_ordering_cell.html → tables/ordering_cell.html} +0 -0
- /wagtail/{search/checks.py → checks.py} +0 -0
- {wagtail-7.1.2.dist-info → wagtail-7.2rc1.dist-info}/WHEEL +0 -0
- {wagtail-7.1.2.dist-info → wagtail-7.2rc1.dist-info}/entry_points.txt +0 -0
- {wagtail-7.1.2.dist-info → wagtail-7.2rc1.dist-info}/licenses/LICENSE +0 -0
- {wagtail-7.1.2.dist-info → wagtail-7.2rc1.dist-info}/top_level.txt +0 -0
|
@@ -1,253 +1 @@
|
|
|
1
|
-
from
|
|
2
|
-
from warnings import warn
|
|
3
|
-
|
|
4
|
-
from django.core.exceptions import FieldDoesNotExist
|
|
5
|
-
from django.db import models
|
|
6
|
-
from django.db.models import Count
|
|
7
|
-
from django.db.models.expressions import Value
|
|
8
|
-
|
|
9
|
-
from wagtail.search.backends.base import (
|
|
10
|
-
BaseSearchBackend,
|
|
11
|
-
BaseSearchQueryCompiler,
|
|
12
|
-
BaseSearchResults,
|
|
13
|
-
FilterFieldError,
|
|
14
|
-
)
|
|
15
|
-
from wagtail.search.query import And, Boost, MatchAll, Not, Or, Phrase, PlainText
|
|
16
|
-
from wagtail.search.utils import AND, OR
|
|
17
|
-
|
|
18
|
-
# This file implements a database search backend using basic substring matching, and no
|
|
19
|
-
# database-specific full-text search capabilities. It will be used in the following cases:
|
|
20
|
-
# * The current default database is SQLite <3.19, or SQLite built without fulltext
|
|
21
|
-
# extensions, or something other than PostgreSQL, MySQL or SQLite
|
|
22
|
-
# * 'wagtail.search.backends.database.fallback' is specified directly as the search backend
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
MATCH_ALL = "_ALL_"
|
|
26
|
-
MATCH_NONE = "_NONE_"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class DatabaseSearchQueryCompiler(BaseSearchQueryCompiler):
|
|
30
|
-
DEFAULT_OPERATOR = "and"
|
|
31
|
-
OPERATORS = {
|
|
32
|
-
"and": AND,
|
|
33
|
-
"or": OR,
|
|
34
|
-
}
|
|
35
|
-
HANDLES_ORDER_BY_EXPRESSIONS = True
|
|
36
|
-
|
|
37
|
-
def __init__(self, *args, **kwargs):
|
|
38
|
-
super().__init__(*args, **kwargs)
|
|
39
|
-
self.fields_names = list(self.get_fields_names())
|
|
40
|
-
|
|
41
|
-
def get_fields_names(self):
|
|
42
|
-
model = self.queryset.model
|
|
43
|
-
fields_names = self.fields or [
|
|
44
|
-
field.field_name for field in model.get_searchable_search_fields()
|
|
45
|
-
]
|
|
46
|
-
# Check if the field exists (this will filter out indexed callables)
|
|
47
|
-
for field_name in fields_names:
|
|
48
|
-
try:
|
|
49
|
-
model._meta.get_field(field_name)
|
|
50
|
-
except FieldDoesNotExist:
|
|
51
|
-
continue
|
|
52
|
-
else:
|
|
53
|
-
yield field_name
|
|
54
|
-
|
|
55
|
-
def _process_lookup(self, field, lookup, value):
|
|
56
|
-
return models.Q(
|
|
57
|
-
**{field.get_attname(self.queryset.model) + "__" + lookup: value}
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
def _process_match_none(self):
|
|
61
|
-
return models.Q(pk__in=[])
|
|
62
|
-
|
|
63
|
-
def _connect_filters(self, filters, connector, negated):
|
|
64
|
-
if connector == "AND":
|
|
65
|
-
q = models.Q(*filters)
|
|
66
|
-
elif connector == "OR":
|
|
67
|
-
q = OR([models.Q(fil) for fil in filters])
|
|
68
|
-
else:
|
|
69
|
-
return
|
|
70
|
-
|
|
71
|
-
if negated:
|
|
72
|
-
q = ~q
|
|
73
|
-
|
|
74
|
-
return q
|
|
75
|
-
|
|
76
|
-
def build_single_term_filter(self, term):
|
|
77
|
-
term_query = models.Q()
|
|
78
|
-
for field_name in self.fields_names:
|
|
79
|
-
term_query |= models.Q(**{field_name + "__icontains": term})
|
|
80
|
-
return term_query
|
|
81
|
-
|
|
82
|
-
def check_boost(self, query, boost=1.0):
|
|
83
|
-
if query.boost * boost != 1.0:
|
|
84
|
-
warn("Database search backend does not support term boosting.")
|
|
85
|
-
|
|
86
|
-
def build_database_filter(self, query, boost=1.0):
|
|
87
|
-
if isinstance(query, PlainText):
|
|
88
|
-
self.check_boost(query, boost=boost)
|
|
89
|
-
|
|
90
|
-
operator = self.OPERATORS[query.operator]
|
|
91
|
-
|
|
92
|
-
return operator(
|
|
93
|
-
[
|
|
94
|
-
self.build_single_term_filter(term)
|
|
95
|
-
for term in query.query_string.split()
|
|
96
|
-
]
|
|
97
|
-
)
|
|
98
|
-
|
|
99
|
-
if isinstance(query, Phrase):
|
|
100
|
-
q = models.Q()
|
|
101
|
-
for field_name in self.fields_names:
|
|
102
|
-
q |= models.Q(**{field_name + "__icontains": query.query_string})
|
|
103
|
-
return q
|
|
104
|
-
|
|
105
|
-
if isinstance(query, Boost):
|
|
106
|
-
boost *= query.boost
|
|
107
|
-
return self.build_database_filter(query.subquery, boost=boost)
|
|
108
|
-
|
|
109
|
-
if isinstance(query, MatchAll):
|
|
110
|
-
return MATCH_ALL
|
|
111
|
-
|
|
112
|
-
if isinstance(query, Not):
|
|
113
|
-
q = self.build_database_filter(query.subquery, boost=boost)
|
|
114
|
-
|
|
115
|
-
if q == MATCH_ALL:
|
|
116
|
-
return MATCH_NONE
|
|
117
|
-
|
|
118
|
-
elif q == MATCH_NONE:
|
|
119
|
-
return MATCH_ALL
|
|
120
|
-
|
|
121
|
-
else:
|
|
122
|
-
return ~q
|
|
123
|
-
|
|
124
|
-
if isinstance(query, And):
|
|
125
|
-
subqueries = [
|
|
126
|
-
self.build_database_filter(subquery, boost=boost)
|
|
127
|
-
for subquery in query.subqueries
|
|
128
|
-
]
|
|
129
|
-
|
|
130
|
-
# If there's a MATCH_NONE, return MATCH_NONE
|
|
131
|
-
if MATCH_NONE in subqueries:
|
|
132
|
-
return MATCH_NONE
|
|
133
|
-
|
|
134
|
-
# Ignore MATCH_ALL
|
|
135
|
-
subqueries = [q for q in subqueries if q != MATCH_ALL]
|
|
136
|
-
|
|
137
|
-
return AND(subqueries)
|
|
138
|
-
|
|
139
|
-
if isinstance(query, Or):
|
|
140
|
-
subqueries = [
|
|
141
|
-
self.build_database_filter(subquery, boost=boost)
|
|
142
|
-
for subquery in query.subqueries
|
|
143
|
-
]
|
|
144
|
-
|
|
145
|
-
# If there's a MATCH_ALL, return MATCH_ALL
|
|
146
|
-
if MATCH_ALL in subqueries:
|
|
147
|
-
return MATCH_ALL
|
|
148
|
-
|
|
149
|
-
# Ignore MATCH_NONE
|
|
150
|
-
subqueries = [q for q in subqueries if q != MATCH_NONE]
|
|
151
|
-
|
|
152
|
-
return OR(subqueries)
|
|
153
|
-
|
|
154
|
-
raise NotImplementedError(
|
|
155
|
-
"`%s` is not supported by the database search backend."
|
|
156
|
-
% query.__class__.__name__
|
|
157
|
-
)
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
class DatabaseAutocompleteQueryCompiler(DatabaseSearchQueryCompiler):
|
|
161
|
-
# The fallback backend doesn't handle word boundaries, so standard searches are
|
|
162
|
-
# essentially equivalent to autocomplete queries anyhow. However, to provide a
|
|
163
|
-
# consistent API with other backends, we provide both endpoints.
|
|
164
|
-
pass
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
class DatabaseSearchResults(BaseSearchResults):
|
|
168
|
-
iterator_chunk_size = 2000
|
|
169
|
-
|
|
170
|
-
def get_queryset(self):
|
|
171
|
-
queryset = self.query_compiler.queryset
|
|
172
|
-
|
|
173
|
-
# Run _get_filters_from_queryset to test that no fields that are not
|
|
174
|
-
# a FilterField have been used in the query.
|
|
175
|
-
self.query_compiler._get_filters_from_queryset()
|
|
176
|
-
|
|
177
|
-
q = self.query_compiler.build_database_filter(self.query_compiler.query)
|
|
178
|
-
|
|
179
|
-
if q == MATCH_ALL:
|
|
180
|
-
pass
|
|
181
|
-
elif q == MATCH_NONE:
|
|
182
|
-
queryset = queryset.none()
|
|
183
|
-
else:
|
|
184
|
-
queryset = queryset.filter(q)
|
|
185
|
-
|
|
186
|
-
return queryset.distinct()[self.start : self.stop]
|
|
187
|
-
|
|
188
|
-
def _do_search(self):
|
|
189
|
-
queryset = self.get_queryset()
|
|
190
|
-
|
|
191
|
-
if self._score_field:
|
|
192
|
-
queryset = queryset.annotate(
|
|
193
|
-
**{self._score_field: Value(None, output_field=models.FloatField())}
|
|
194
|
-
)
|
|
195
|
-
|
|
196
|
-
return queryset.iterator(self.iterator_chunk_size)
|
|
197
|
-
|
|
198
|
-
def _do_count(self):
|
|
199
|
-
return self.get_queryset().count()
|
|
200
|
-
|
|
201
|
-
supports_facet = True
|
|
202
|
-
|
|
203
|
-
def facet(self, field_name):
|
|
204
|
-
# Get field
|
|
205
|
-
field = self.query_compiler._get_filterable_field(field_name)
|
|
206
|
-
if field is None:
|
|
207
|
-
raise FilterFieldError(
|
|
208
|
-
'Cannot facet search results with field "'
|
|
209
|
-
+ field_name
|
|
210
|
-
+ "\". Please add index.FilterField('"
|
|
211
|
-
+ field_name
|
|
212
|
-
+ "') to "
|
|
213
|
-
+ self.query_compiler.queryset.model.__name__
|
|
214
|
-
+ ".search_fields.",
|
|
215
|
-
field_name=field_name,
|
|
216
|
-
)
|
|
217
|
-
|
|
218
|
-
query = self.get_queryset()
|
|
219
|
-
results = (
|
|
220
|
-
query.values(field_name).annotate(count=Count("pk")).order_by("-count")
|
|
221
|
-
)
|
|
222
|
-
|
|
223
|
-
return OrderedDict(
|
|
224
|
-
[(result[field_name], result["count"]) for result in results]
|
|
225
|
-
)
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
class DatabaseSearchBackend(BaseSearchBackend):
|
|
229
|
-
query_compiler_class = DatabaseSearchQueryCompiler
|
|
230
|
-
autocomplete_query_compiler_class = DatabaseSearchQueryCompiler
|
|
231
|
-
results_class = DatabaseSearchResults
|
|
232
|
-
|
|
233
|
-
def reset_index(self):
|
|
234
|
-
pass # Not needed
|
|
235
|
-
|
|
236
|
-
def add_type(self, model):
|
|
237
|
-
pass # Not needed
|
|
238
|
-
|
|
239
|
-
def refresh_index(self):
|
|
240
|
-
pass # Not needed
|
|
241
|
-
|
|
242
|
-
def add(self, obj):
|
|
243
|
-
pass # Not needed
|
|
244
|
-
|
|
245
|
-
def add_bulk(self, model, obj_list):
|
|
246
|
-
return # Not needed
|
|
247
|
-
|
|
248
|
-
def delete(self, obj):
|
|
249
|
-
pass # Not needed
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
# This line allows using 'wagtail.search.backends.database.fallback' as the backend, bypassing the automatic selection of the backend that would get run if the user chose 'wagtail.search.backends.database'
|
|
253
|
-
SearchBackend = DatabaseSearchBackend
|
|
1
|
+
from wagtailmodelsearch.backends.database.fallback import * # noqa: F403
|