0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00
Commit Graph

10696 Commits

Author SHA1 Message Date
Matt Westcott
93a80efe50 Add docs for modifying StreamField data 2020-12-08 16:57:10 +00:00
Matt Westcott
5af357b373 Add end-to-end test of updating a streamfield in-place 2020-12-08 16:57:10 +00:00
Matt Westcott
e90b6af872 Reinstate stream_data as a deprecated property of StreamValue
This (hopefully) fully replicates the old behaviour of stream_data, returning raw JSON data for lazy StreamValues and the tuple representation for non-lazy values.
2020-12-08 16:57:10 +00:00
Matt Westcott
23849d81be Give BoundBlock, StreamValue and RawDataView more helpful repr()s
It seems quite likely that the lack of nice representations for these in the shell / debugger is what stopped people from realising that they could index StreamValue as an array, and led them towards stream_data instead ("ooh, this looks like an array of data... I know how to deal with this")
2020-12-08 16:57:09 +00:00
Matt Westcott
37d4e841d7 Provide a raw_data accessor on StreamValue to allow accessing and modifying the raw JSON representation
This matches the old behaviour of stream_data for lazy StreamValues. Given that a lazy StreamValue is what you get as standard when retrieving a model instance from the database (or from a PageRevision), any existing user code that casually tinkered with stream_data unaware of the lazy versus non-lazy gotcha is almost certainly expecting it to behave this way - therefore in 99% of cases those users should be able to replace `stream_data` with `raw_data` and have their code work as before, with the added bonus that it won't fall over on page previews (which get their data from a form submission in Python format rather than JSON, and are thus NOT lazy).
2020-12-08 16:57:09 +00:00
Matt Westcott
aab619550f Implement __delitem__ and insert on StreamValue 2020-12-08 16:57:09 +00:00
Matt Westcott
683c95e3ec Convert _bound_blocks from a dict into a list with None as placeholders
This makes it a lot easier to implement __delitem__ and insert, since we don't have to renumber indexes...
2020-12-08 16:57:09 +00:00
Matt Westcott
caade5f0de implement __setitem__ on StreamValue 2020-12-08 16:57:09 +00:00
Matt Westcott
603dc650e5 Eliminate stream_data for StreamValue internal storage
Since stream_data existed in lazy (JSONish dicts) and non-lazy (tuples containing native values) variants, retrieval and serialisation each required two separate code paths. We now have a single representation, consisting of the raw JSONish data in _raw_data (unused if we were initialised with native data) and a cache of StreamChild objects in _bound_blocks (prefilled if we were initialised with native data).
2020-12-08 16:57:08 +00:00
Matt Westcott
b05173db51 Add tests for modifying StreamField data by writing to StreamChild objects
This wasn't designed to be possible, but it's useful enough that someone somewhere is bound to have done it...
2020-12-08 16:57:08 +00:00
Matt Westcott
9a953fd93c Additional release notes for #6559 2020-12-08 16:00:47 +00:00
Dan Braghis
0da2ba69bc Fix missing locale in the project template's homepage migration 2020-12-08 14:11:23 +00:00
Matt Westcott
2dfb82406a whitespace fix 2020-12-08 12:53:41 +00:00
Matt Westcott
4dc9f81d68 Add {% if page %} around language selector example
As suggested here: https://stackoverflow.com/questions/65065301/wagtail-not-redirecting-500-error-instead-of-404-when-debug-false/65065608?noredirect=1#comment115125518_65065608
2020-12-08 12:53:41 +00:00
Thibaud Colas
06c3c3a24b
Replace image upload in wagtailforms tutorial with latest version. Fix #5284 2020-12-08 10:20:48 +00:00
Scott Cranfill
bba831d2cf
Update pagination icons to use SVGs (#6573)
Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
2020-12-04 17:03:50 +00:00
Matt Westcott
cbf0be31d5 revert to @allcaps's original approach to including robots.txt 2020-12-04 13:30:55 +00:00
Alex Sa
01d3854696
Add collection_id param to document chooser pagination handling. Fix #5913 (#6529)
Make sure document chooser pagination preserves the selected collection when moving between pages

Co-authored-by: Alexander Sajzew <a.sajzew@alexsa.de>
Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
2020-12-02 12:41:37 +00:00
Karran Besen
65d0cdf55f
Fix breadcrumb margin overlapping burger menu. Fix #6590 (#6597)
Stop menu icon overlapping the breadcrumb on small viewport widths in page editor

Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
2020-12-02 12:05:13 +00:00
Matt Westcott
7f4c914e68 try a different approach for including custom robots.txt 2020-12-02 11:13:23 +00:00
minusf
a18a36d820
Fix indentation of locked_by block in documentation (#6580) 2020-12-02 10:40:25 +00:00
alistairclark
25b9139a7c Changes repr method of Phrase to label the object Phrase instead of PlainText 2020-12-01 11:06:52 +00:00
Andy Chosak
fe427efb75 Fix Bonsai link in Elasticsearch docs
The search docs [0] currently link to a Bonsai signup page that 404s [1].
The signup page is currently a different page [2].
This commit replaces the Bonsai link with their homepage [3],
to avoid being overly dependent on their URL structure.

[0] https://docs.wagtail.io/en/v2.11.2/topics/search/backends.html
[1] https://bonsai.io/signup
[2] https://app.bonsai.io/signup
[3] https://bonsai.io/
2020-11-24 12:16:53 +00:00
Frantisek Holop
8f4e799fb8 remove double returns 2020-11-24 12:16:17 +00:00
Matt Westcott
2cefe4ebd9 update translators list 2020-11-17 15:57:59 +00:00
Matt Westcott
83f7d4c2d7 Generate new strings for translation 2020-11-17 15:44:28 +00:00
Matt Westcott
0a90a30b10 Fetch new translations from Transifex 2020-11-17 15:44:27 +00:00
Matt Westcott
56a92d466e Fill in release date for 2.11.2
Conflicts:
	CHANGELOG.txt
2020-11-17 15:44:24 +00:00
Cynthia Kiser
28cee081b2 Add custom oEmbed finders for Facebook and Instagram (#6550)
Move code from https://www.codista.com/en/blog/wagtail-instagram-new-oembed-api/ into core

Add custom oembed finder for Facebook

Apply suggestions from @originell's code review

Co-authored-by: Luis Nell <luis.nell@codista.com>

FIXUP More places to change the exception name (and a linter fix)

Extend Instagram/Facebook tests to check HTTP request

Add documentation for omitscript parameter
2020-11-17 15:06:24 +00:00
Matt Westcott
9ef3685efc Allow deleting the default locale (#6553)
Fixes #6533
2020-11-17 11:25:52 +00:00
Matt Westcott
414571cc99 Release note for #6544 2020-11-16 17:15:32 +00:00
Karl Hobley
62ccde9c09 Fetch all pages of translations 2020-11-16 17:07:22 +00:00
Karl Hobley
41b0abc28c Fix performance issue in React explorer when there are many languages
Requesting translations to be nested with each page causes major
performance problems when there are many languages. Mozilla have 61
languages, each with a separate homepage that's a translation of the
others, so the response for this query contains details of 61 * 61 pages
for them.

This isn't actually required since we only need to know the translations
if the user navigates into a page, and the translations are requested
again anyway by the getPageTranslations function.
2020-11-16 17:07:22 +00:00
Jérôme Lebleu
f88e6f91ff Fix header icon name in settings' edit view (#6554) 2020-11-16 15:02:19 +00:00
Matt Westcott
236632d815
Handle get_supported_language_variant returning a language variant not in LANGUAGES (#6547)
* Handle get_supported_language_variant returning a language variant not in LANGUAGES

Fixes #6539

* Handle LANGUAGE_CODE that isn't in LANGUAGES

* Release note for #6547
2020-11-16 11:51:32 +00:00
Matt Westcott
a888d3383c Gracefully handle missing Locale records on Locale.get_active and .localized (#6549)
Fixes #6540
There are various code paths where Page.localized and similar can be called even when WAGTAIL_I18N_ENABLED is False, and since it's entirely likely that hand-rolled i18n mechanisms and ad-hoc configuration changes (e.g changing LANGUAGE_CODE) will break the Locale model's assumptions about how things are meant to work, we need to provide sensible fallback behaviour for when the current active locale, or the default locale as per LANGUAGE_CODE, does not have a corresponding Locale record:

* Locale.get_active() will fall back on the default LANGUAGE_CODE locale, or raise Locale.DoesNotExist if that one does not exist either;
* TranslatableMixin.localized (along with Page.localized and Page.localized_draft) will handle a missing Locale record by falling back on the default LANGUAGE_CODE locale, or failing that, returning self.
2020-11-16 10:31:01 +00:00
Karl Hobley
792a9d272b Fetch the depth field of page translations on the edit view
This field is used in the `.can_edit()` permission check
2020-11-13 17:14:22 +00:00
Coen van der Kamp
4702b6f14d Add custom robots.txt to docs 2020-11-12 16:35:05 +00:00
Matt Westcott
be45cee2aa Fill in release date for 2.11.1 2020-11-06 17:30:55 +00:00
Matt Westcott
c2e6c0f1aa Fetch new translations from Transifex 2020-11-06 17:17:54 +00:00
Matt Westcott
f378f48e14 Prevent errors on get_url_parts when a non-content-language locale is active (#6521)
Fixes #6510 and #6511

Catch the LookupError from get_supported_content_language_variant so that if the active language is not one that is recognised as a content language, the URL prefix will be left unchanged from the page's reported locale.

Additionally, skip the `translation.override` when WAGTAIL_I18N_ENABLED is false; this accounts for the fact that existing sites may have used alternative / custom i18n implementations involving i18n_patterns, and on these sites we can't rely on the page's locale field to be meaningful. That way, we restore the pre-2.11 behaviour: if the existing i18n code was using some kind of wrapper around the get_url_parts call, then that will work again; and if not, the URL will reflect the current active locale, which is no worse than before.
2020-11-06 17:04:18 +00:00
Thibaud Colas
37e9e1d54d
#6090 Document accessibility considerations (#6272)
Co-authored-by: Coen van der Kamp <coen@fourdigits.nl>
2020-11-06 15:38:00 +00:00
Thibaud Colas
063c7d8b44 Switch IE11 home warning message to show for all users regardless of role 2020-11-06 09:46:26 +00:00
Matt Westcott
3c984b9871 Avoid circular import between wagtail.admin.auth and custom user models (#6522)
Fixes #6518

If the models.py containing a custom user model directly or indirectly imports wagtail.admin.auth, this causes a circular dependency because wagtail.admin.auth attempts to import django.contrib.auth.views, which in turn depends on the custom user model. Fix this by moving the django.contrib.auth.views import inside reject_request.
2020-11-06 09:35:21 +00:00
Matt Westcott
ed1996cdbc Upgrade consideration note for dropping Elasticsearch 2 2020-11-05 12:04:12 +00:00
Matt Westcott
a6a70dff04 Refactor Elasticsearch backend classes to drop version 2 2020-11-05 12:04:12 +00:00
Matt Westcott
6e1e36256a Remove elasticsearch 2 support 2020-11-05 12:04:12 +00:00
Matt Westcott
4d6a41a83b Drop travis entirely 2020-11-05 12:04:12 +00:00
Matt Westcott
35a8255ded Ditch all travis config except for elasticsearch 2 test 2020-11-05 12:04:12 +00:00
Matt Westcott
ea9298bd71 add Github Actions config 2020-11-05 12:04:12 +00:00