0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-25 05:02:57 +01:00

Fix capitalisation of QuerySet

This commit is contained in:
Karl Hobley 2018-04-03 17:21:03 +01:00
parent a70b8130a5
commit bf3e994505
10 changed files with 20 additions and 20 deletions

View File

@ -381,7 +381,7 @@ model like this:
context['blogpages'] = blogpages
return context
All we've done here is retrieve the original context, create a custom queryset,
All we've done here is retrieve the original context, create a custom QuerySet,
add it to the retrieved context, and return the modified context back to the view.
You'll also need to modify your ``blog_index_page.html`` template slightly.
Change:
@ -661,7 +661,7 @@ Note that this Page-based model defines no fields of its own.
Even without fields, subclassing ``Page`` makes it a part of the
Wagtail ecosystem, so that you can give it a title and URL in the
admin, and so that you can manipulate its contents by returning
a queryset from its ``get_context()`` method.
a QuerySet from its ``get_context()`` method.
Migrate this in, then create a new ``BlogTagIndexPage`` in the admin.
You'll probably want to create the new page/view as a child of Homepage,

View File

@ -293,7 +293,7 @@ Set ``search_fields`` to enable a search box at the top of the index page
for your model. You should add names of any fields on the model that should
be searched whenever somebody submits a search query using the search box.
Searching is all handled via Django's queryset API, rather than using Wagtail's
Searching is all handled via Django's QuerySet API, rather than using Wagtail's
search backend. This means it will work for all models, whatever search backend
your project is using, and without any additional setup or configuration.
@ -332,7 +332,7 @@ of the index view. By default, this is set to ``100``.
**Must return**: A QuerySet
The ``get_queryset`` method returns the 'base' queryset for your model, to
The ``get_queryset`` method returns the 'base' QuerySet for your model, to
which any filters and search queries are applied. By default, the ``all()``
method of your model's default manager is used. But, if for any reason you
only want a certain sub-set of objects to appear in the IndexView listing,

View File

@ -251,7 +251,7 @@ Hooks for building new areas of the admin interface (alongside pages, images, do
``register_permissions``
~~~~~~~~~~~~~~~~~~~~~~~~
Return a queryset of ``Permission`` objects to be shown in the Groups administration area.
Return a QuerySet of ``Permission`` objects to be shown in the Groups administration area.
.. _filter_form_submissions_for_user:
@ -638,7 +638,7 @@ Choosers
``construct_page_chooser_queryset``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Called when rendering the page chooser view, to allow the page listing queryset to be customised. The callable passed into the hook will receive the current page queryset and the request object, and must return a Page queryset (either the original one, or a new one).
Called when rendering the page chooser view, to allow the page listing QuerySet to be customised. The callable passed into the hook will receive the current page QuerySet and the request object, and must return a Page QuerySet (either the original one, or a new one).
.. code-block:: python
@ -657,7 +657,7 @@ Choosers
``construct_document_chooser_queryset``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Called when rendering the document chooser view, to allow the document listing queryset to be customised. The callable passed into the hook will receive the current document queryset and the request object, and must return a Document queryset (either the original one, or a new one).
Called when rendering the document chooser view, to allow the document listing QuerySet to be customised. The callable passed into the hook will receive the current document QuerySet and the request object, and must return a Document QuerySet (either the original one, or a new one).
.. code-block:: python
@ -676,7 +676,7 @@ Choosers
``construct_image_chooser_queryset``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Called when rendering the image chooser view, to allow the image listing queryset to be customised. The callable passed into the hook will receive the current image queryset and the request object, and must return a Document queryset (either the original one, or a new one).
Called when rendering the image chooser view, to allow the image listing QuerySet to be customised. The callable passed into the hook will receive the current image QuerySet and the request object, and must return a Document QuerySet (either the original one, or a new one).
.. code-block:: python
@ -698,7 +698,7 @@ Page explorer
``construct_explorer_page_queryset``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Called when rendering the page explorer view, to allow the page listing queryset to be customised. The callable passed into the hook will receive the parent page object, the current page queryset, and the request object, and must return a Page queryset (either the original one, or a new one).
Called when rendering the page explorer view, to allow the page listing QuerySet to be customised. The callable passed into the hook will receive the parent page object, the current page QuerySet, and the request object, and must return a Page QuerySet (either the original one, or a new one).
.. code-block:: python

View File

@ -185,7 +185,7 @@ Now that we have the many-to-many tag relationship in place, we can fit in a way
'blogs': blogs,
})
Here, ``blogs.filter(tags__name=tag)`` invokes a reverse Django queryset filter on the ``BlogPageTag`` model to optionally limit the ``BlogPage`` objects sent to the template for rendering. Now, lets render both sides of the relation by showing the tags associated with an object and a way of showing all of the objects associated with each tag. This could be added to the ``blog_page.html`` template:
Here, ``blogs.filter(tags__name=tag)`` invokes a reverse Django QuerySet filter on the ``BlogPageTag`` model to optionally limit the ``BlogPage`` objects sent to the template for rendering. Now, lets render both sides of the relation by showing the tags associated with an object and a way of showing all of the objects associated with each tag. This could be added to the ``blog_page.html`` template:
.. code-block:: html+django

View File

@ -47,7 +47,7 @@ Minor features
* ``register_snippet`` can now be invoked as a decorator.
* The project template (used when running ``wagtail start``) has been updated to Django 1.7.
* The 'boost' applied to the title field on searches has been reduced from 100 to 2.
* The ``type`` method of ``PageQuerySet`` (used to filter the queryset to a specific page type) now includes subclasses of the given page type.
* The ``type`` method of ``PageQuerySet`` (used to filter the QuerySet to a specific page type) now includes subclasses of the given page type.
* The ``update_index`` management command now updates all backends listed in ``WAGTAILSEARCH_BACKENDS``, or a specific one passed on the command line, rather than just the default backend.
* The 'fill' image resize method now supports an additional parameter defining the closeness of the crop. See :ref:`image_tag`
* Added support for invalidating Cloudflare caches. See :ref:`frontend_cache_purging`
@ -58,7 +58,7 @@ Bug fixes
* The 'wagtail start' command now works on Windows and other environments where the ``django-admin.py`` executable is not readily accessible.
* The external image URL generator no longer stores generated images in Django's cache; this was an unintentional side-effect of setting cache control headers.
* The Elasticsearch backend can now search querysets that have been filtered with an 'in' clause of a non-list type (such as a ``ValuesListQuerySet``).
* The Elasticsearch backend can now search QuerySets that have been filtered with an 'in' clause of a non-list type (such as a ``ValuesListQuerySet``).
* Logic around the ``has_unpublished_changes`` flag has been fixed, to prevent issues with the 'View draft' button failing to show in some cases.
* It is now easier to move pages to the beginning and end of their section
* Image rendering no longer creates erroneous duplicate Rendition records when the focal point is blank.

View File

@ -13,7 +13,7 @@ What's new
``specific()`` method on PageQuerySet
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Usually, an operation that retrieves a queryset of pages (such as ``homepage.get_children()``) will return them as basic Page instances, which only include the core page data such as title. The ``specific()`` method (e.g. ``homepage.get_children().specific()``) now allows them to be retrieved as their most specific type, using the minimum number of queries.
Usually, an operation that retrieves a QuerySet of pages (such as ``homepage.get_children()``) will return them as basic Page instances, which only include the core page data such as title. The ``specific()`` method (e.g. ``homepage.get_children().specific()``) now allows them to be retrieved as their most specific type, using the minimum number of queries.
"Promoted search results" has moved into its own module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -86,7 +86,7 @@ Bug fixes
* Search no longer crashes when auto-indexing a model that doesn't have an ``id`` field
* The ``wagtailfrontendcache`` module's HTTP backend has been rewritten to reliably direct requests to the configured cache hostname
* Resizing single pixel images with the "fill" filter no longer raises "ZeroDivisionError" or "tile cannot extend outside image"
* The queryset returned from ``search`` operations when using the database search backend now correctly preserves additional properties of the original query, such as ``prefetch_related`` / ``select_related``
* The QuerySet returned from ``search`` operations when using the database search backend now correctly preserves additional properties of the original query, such as ``prefetch_related`` / ``select_related``
* Responses from the external image URL generator are correctly marked as streaming and will no longer fail when used with Django's cache middleware
* Page copy now works with pages that use multiple inheritance
* Form builder pages now pick up template variables defined in the ``get_context`` method

View File

@ -16,7 +16,7 @@ Bug fixes
* API listing views no longer fail when no site records are defined (Karl Hobley)
* Pinned Django REST Framework to <3.7 to restore Django 1.8 compatibility (Matt Westcott)
* Fixed crash in XML sitemap generator when all pages on the site are private (Stein Strindhaug)
* Fixed error in Postgres search backend when searching specific fields of a ``specific()`` Page queryset (Bertrand Bordage, Matt Westcott)
* Fixed error on Elasticsearch backend when passing a queryset as an ``__in`` filter (Karl Hobley, Matt Westcott)
* Fixed error in Postgres search backend when searching specific fields of a ``specific()`` Page QuerySet (Bertrand Bordage, Matt Westcott)
* Fixed error on Elasticsearch backend when passing a QuerySet as an ``__in`` filter (Karl Hobley, Matt Westcott)
* ``__isnull`` filters no longer fail on Elasticsearch 5 (Karl Hobley)
* Prevented intermittent failures on Postgres search backend when a field is defined as both a ``SearchField`` and a ``FilterField`` (Matt Westcott)

View File

@ -16,7 +16,7 @@ Bug fixes
* API listing views no longer fail when no site records are defined (Karl Hobley)
* Fixed crash in XML sitemap generator when all pages on the site are private (Stein Strindhaug)
* Fixed incorrect z-index on userbar causing it to appear behind page content (Stein Strindhaug)
* Fixed error in Postgres search backend when searching specific fields of a ``specific()`` Page queryset (Bertrand Bordage, Matt Westcott)
* Fixed error on Elasticsearch backend when passing a queryset as an ``__in`` filter (Karl Hobley, Matt Westcott)
* Fixed error in Postgres search backend when searching specific fields of a ``specific()`` Page QuerySet (Bertrand Bordage, Matt Westcott)
* Fixed error on Elasticsearch backend when passing a QuerySet as an ``__in`` filter (Karl Hobley, Matt Westcott)
* ``__isnull`` filters no longer fail on Elasticsearch 5 (Karl Hobley)
* Prevented intermittent failures on Postgres search backend when a field is defined as both a ``SearchField`` and a ``FilterField`` (Matt Westcott)

View File

@ -70,7 +70,7 @@ Other features
* ``ChoiceBlock`` now accepts a callable as the choices list (Mikalai Radchuk)
* Redundant action buttons are now omitted from the root page in the explorer (Nick Smith)
* Locked pages are now disabled from editing at the browser level (Edd Baldry)
* Added :meth:`wagtail.core.query.PageQuerySet.in_site` method for filtering page querysets to pages within the specified site (Chris Rogers)
* Added :meth:`wagtail.core.query.PageQuerySet.in_site` method for filtering page QuerySets to pages within the specified site (Chris Rogers)
* Added the ability to override the default index settings for Elasticsearch. See :ref:`wagtailsearch_backends_elasticsearch` (PyMan Claudio Marinozzi)
* Extra options for the Elasticsearch constructor should be now defined with the new key ``OPTIONS`` of the ``WAGTAILSEARCH_BACKENDS`` setting (PyMan Claudio Marinozzi)

View File

@ -96,7 +96,7 @@ Bug fixes
* Project template now has password validators enabled by default (Matt Westcott)
* Alignment options correctly removed from ``TableBlock`` context menu (LB (Ben Johnston))
* Fix support of ``ATOMIC_REBUILD`` for projects with Elasticsearch client ``>=1.7.0`` (Mikalai Radchuk)
* Fixed error on Elasticsearch backend when passing a queryset as an ``__in`` filter (Karl Hobley, Matt Westcott)
* Fixed error on Elasticsearch backend when passing a QuerySet as an ``__in`` filter (Karl Hobley, Matt Westcott)
* ``__isnull`` filters no longer fail on Elasticsearch 5 (Karl Hobley)
* Prevented intermittent failures on Postgres search backend when a field is defined as both a ``SearchField`` and a ``FilterField`` (Matt Westcott)
* Alt text of images in rich text is no longer truncated on double-quote characters (Matt Westcott)