This allows the user to retrieve the scores for each search result:
for page in Page.objects.search("Hello").annotate_score('_score'):
print(page.title, page._score)
* Created Elasticsearch 2 backend
* Added tests for Elasticsearch 2 backend
* Split models up into different indices
pages, images and documents are now in separate indices
* Prefix fields of child models to prevent mapping clashes
* Replaced index_analyzer with analyzer/search_analyzer
index_analyzer has been removed in Elasticsearch 2.0
https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking_20_mapping_changes.html#_analyzer_mappings
There's no indication in Elasticsearch's docs that this wouldn't work on Elasticsearch 1.x. However, we found that the new configuration isn't reliable on Elasticsearch 1.6 and below (causes the test_query_analyzer test to fail randomly).
* Implemented new way of representing content types in search index
Instead of using a long string of model names that is queried using a
"prefix" query, we instead use a multi-value string field and query it
using a simple "match" query.
The only reason why this isn't implemented in the Elasticsearch 1.x
backend yet is backwards compatibility
* Added another child model of SearchTest with clashing field mapping
This checks that the namespacing of fields on child models is working properly (if it doesn't the update_index tests will fail)
* Added tests for get_model_root function
* fixup! Added tests for get_model_root function
* Docs updates for Elasticsearch 2 support
Also tweak examples to use elasticsearch2 backend by default
* Test against Elasticsearch 2 on travis
* added base cloudfrontbackend and testcase
* added boto3 cloudfront client
* implemented create invalidation method
added error handling botocore
* added aws docs
* fixed typo
* flake8 fixes
* added boto3 configuration docs
* removed return
* purge path instead of full url
* added multisite hostname mapping
* added validation of DISTRIBUTION_ID
* renamed Cloudfront to CloudFront
* added note to include www in mapping
added tests for cloudfront site mapping
* removed deprecated has_key, used in
fixed _create_invalidation
* changed type checking of dict
removed debug line of code to check hostname
* fixed dict type checking condition
added assert t make sure no invalid cache is being purged
* changed import order
* fixed isort error
* more detailed error message for cloudfront
pep8 fixes 120 chars per line
* Log missing cloudfront distribution id as info
Was logging as error, but it may be possible that a developer wants cloudfront on only specific hostnames.
* , => .
* Docs edits
* Removed hard-dependency on boto3
* Ship our own copies of urlify.js and xregexp.min.js
This avoids issues with missing files when using Django 1.8 or omitting django.contrib.admin from INSTALLED_APPS (#2927), and guards against any breaking changes to these files in future Django releases.
* Add a WAGTAIL_ALLOW_UNICODE_SLUGS setting
Django's standard behaviour is to preserve managers that are set on abstract
superclasses, so this allows us to eliminate the metaclass hackery.
Fixes #2933
It should be max and min value - not length. See [here](07c3ba84fb/wagtail/wagtailcore/blocks/field_block.py (L306)).
So this would work
`blocks.IntegerBlock(max_value=10, min_value=0)`
but this wouldn't do anything
`blocks.IntegerBlock(max_length=10, min_length=0)`
This is where developers expect it to be, similar to Django and other
projects. The version info still exists at the old `wagtail.wagtailcore`
location, for backwards compatibility.
Fixes #2557
Client-side validation fails on forms with prefilled file upload fields -
see https://code.djangoproject.com/ticket/27037. This is fixed in Django 1.10.1,
so as a workaround we disable client-side validation (using the 'novalidate'
attribute) for forms with enctype="multipart/form-data" on Django 1.10 only.
Fixes #2897
When building a dummy request, you can now pass in the original request object
to add additional information to the dummy. Currently, that includes the
following headers:
REMOTE_ADDR
HTTP_X_FORWARDED_FOR
HTTP_COOKIE
HTTP_USER_AGENT
More may be added later.
This changes ensures that middleware which work on the client IP aren't flumuxed
by its absense, and also makes it possible for previews to be rendered as the
logged in user (they had previously been rendered using an AnnonymousUser).
Because the user's logged in state is now detectable in a Page previews, the
Wagtail userbar now hides itself explicitly during previews, rather than relying
on the fact that previews used to be built with AnonymousUser.
As mentioned in the comments I didn't see the first pull request (https://github.com/torchbox/wagtail/pull/2509)
However, I think my changes were a tiny bit more complete in terms of UI/UX. I allow to delete a user directly from the user list + you can delete any user if you are superuser, except yourself. This way we are sure to keep at least one superuser but we can still delete superusers.
I added some tests from this PR to my code and also added the permission denied on the delete page.
Update render and render_basic methods on Block to take a context kwarg
Update TableBlock to support passing extra context to render
Implement render_as_block on BoundBlock, StreamValue and StructValue.
Collectively, these are the objects encountered during template rendering which typically render
a block template when output inside {{ ... }} tags. Implementing render_as_block allows us to do
the same thing, but passing a template context as well.
Implement include_block tag
Support extra context vars on include_block via 'with foo=bar'
Support 'only' flag on include_block tag, to omit the parent context
Update StreamField documentation to cover the include_block tag
Rewrite 'BoundBlocks and values' docs based on the include_block tag
Add tests for blocks with legacy render / render_basic methods
Any bits of StreamField infrastructure that attempt to call render or render_basic
on a block with a 'context' kwarg, should (for now) also work on blocks that don't
accept the context kwarg, but output a RemovedInWagtail18Warning.
Explicitly test whether render / render_basic will accept a 'context' kwarg
This avoids unexpected behaviour when the method legitimately accepts a context
kwarg, but happens to throw an unrelated TypeError - in this situation, the final
output (or error diagnostics) will behave as if the context was never passed,
making debugging difficult. See https://github.com/torchbox/wagtail/pull/2786#discussion_r69563984