wagtail 6.4rc1__py3-none-any.whl → 7.0__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.
Files changed (1657) hide show
  1. wagtail/__init__.py +1 -1
  2. wagtail/actions/copy_page.py +4 -4
  3. wagtail/admin/action_menu.py +3 -0
  4. wagtail/admin/active_filters.py +218 -0
  5. wagtail/admin/auth.py +3 -39
  6. wagtail/admin/filters.py +9 -2
  7. wagtail/admin/forms/choosers.py +8 -7
  8. wagtail/admin/forms/models.py +46 -1
  9. wagtail/admin/forms/pages.py +9 -0
  10. wagtail/admin/locale/ar/LC_MESSAGES/django.mo +0 -0
  11. wagtail/admin/locale/ar/LC_MESSAGES/django.po +31 -34
  12. wagtail/admin/locale/ar/LC_MESSAGES/djangojs.mo +0 -0
  13. wagtail/admin/locale/ar/LC_MESSAGES/djangojs.po +9 -1
  14. wagtail/admin/locale/az_AZ/LC_MESSAGES/django.po +1 -1
  15. wagtail/admin/locale/be/LC_MESSAGES/django.mo +0 -0
  16. wagtail/admin/locale/be/LC_MESSAGES/django.po +28 -29
  17. wagtail/admin/locale/be/LC_MESSAGES/djangojs.mo +0 -0
  18. wagtail/admin/locale/be/LC_MESSAGES/djangojs.po +8 -2
  19. wagtail/admin/locale/bg/LC_MESSAGES/django.mo +0 -0
  20. wagtail/admin/locale/bg/LC_MESSAGES/django.po +3 -7
  21. wagtail/admin/locale/bg/LC_MESSAGES/djangojs.mo +0 -0
  22. wagtail/admin/locale/bg/LC_MESSAGES/djangojs.po +5 -2
  23. wagtail/admin/locale/bn/LC_MESSAGES/django.mo +0 -0
  24. wagtail/admin/locale/bn/LC_MESSAGES/django.po +1 -7
  25. wagtail/admin/locale/ca/LC_MESSAGES/django.mo +0 -0
  26. wagtail/admin/locale/ca/LC_MESSAGES/django.po +131 -122
  27. wagtail/admin/locale/ca/LC_MESSAGES/djangojs.mo +0 -0
  28. wagtail/admin/locale/ca/LC_MESSAGES/djangojs.po +8 -2
  29. wagtail/admin/locale/cs/LC_MESSAGES/django.mo +0 -0
  30. wagtail/admin/locale/cs/LC_MESSAGES/django.po +33 -46
  31. wagtail/admin/locale/cs/LC_MESSAGES/djangojs.mo +0 -0
  32. wagtail/admin/locale/cs/LC_MESSAGES/djangojs.po +9 -3
  33. wagtail/admin/locale/cy/LC_MESSAGES/django.mo +0 -0
  34. wagtail/admin/locale/cy/LC_MESSAGES/django.po +1 -7
  35. wagtail/admin/locale/cy/LC_MESSAGES/djangojs.mo +0 -0
  36. wagtail/admin/locale/cy/LC_MESSAGES/djangojs.po +8 -2
  37. wagtail/admin/locale/da/LC_MESSAGES/django.mo +0 -0
  38. wagtail/admin/locale/da/LC_MESSAGES/django.po +4 -21
  39. wagtail/admin/locale/da/LC_MESSAGES/djangojs.mo +0 -0
  40. wagtail/admin/locale/da/LC_MESSAGES/djangojs.po +5 -2
  41. wagtail/admin/locale/de/LC_MESSAGES/django.mo +0 -0
  42. wagtail/admin/locale/de/LC_MESSAGES/django.po +134 -126
  43. wagtail/admin/locale/de/LC_MESSAGES/djangojs.mo +0 -0
  44. wagtail/admin/locale/de/LC_MESSAGES/djangojs.po +9 -2
  45. wagtail/admin/locale/dv/LC_MESSAGES/django.mo +0 -0
  46. wagtail/admin/locale/dv/LC_MESSAGES/django.po +13 -61
  47. wagtail/admin/locale/dv/LC_MESSAGES/djangojs.mo +0 -0
  48. wagtail/admin/locale/dv/LC_MESSAGES/djangojs.po +8 -2
  49. wagtail/admin/locale/el/LC_MESSAGES/django.mo +0 -0
  50. wagtail/admin/locale/el/LC_MESSAGES/django.po +9 -71
  51. wagtail/admin/locale/el/LC_MESSAGES/djangojs.mo +0 -0
  52. wagtail/admin/locale/el/LC_MESSAGES/djangojs.po +9 -2
  53. wagtail/admin/locale/en/LC_MESSAGES/django.po +386 -319
  54. wagtail/admin/locale/en/LC_MESSAGES/djangojs.po +11 -7
  55. wagtail/admin/locale/en_IN/LC_MESSAGES/djangojs.po +2 -2
  56. wagtail/admin/locale/es/LC_MESSAGES/django.mo +0 -0
  57. wagtail/admin/locale/es/LC_MESSAGES/django.po +37 -147
  58. wagtail/admin/locale/es/LC_MESSAGES/djangojs.mo +0 -0
  59. wagtail/admin/locale/es/LC_MESSAGES/djangojs.po +9 -3
  60. wagtail/admin/locale/es_419/LC_MESSAGES/django.mo +0 -0
  61. wagtail/admin/locale/es_419/LC_MESSAGES/django.po +2 -7
  62. wagtail/admin/locale/es_VE/LC_MESSAGES/django.po +2 -1
  63. wagtail/admin/locale/es_VE/LC_MESSAGES/djangojs.po +2 -2
  64. wagtail/admin/locale/et/LC_MESSAGES/django.mo +0 -0
  65. wagtail/admin/locale/et/LC_MESSAGES/django.po +31 -38
  66. wagtail/admin/locale/et/LC_MESSAGES/djangojs.mo +0 -0
  67. wagtail/admin/locale/et/LC_MESSAGES/djangojs.po +8 -2
  68. wagtail/admin/locale/eu/LC_MESSAGES/django.po +1 -1
  69. wagtail/admin/locale/eu/LC_MESSAGES/djangojs.mo +0 -0
  70. wagtail/admin/locale/eu/LC_MESSAGES/djangojs.po +5 -2
  71. wagtail/admin/locale/fa/LC_MESSAGES/django.mo +0 -0
  72. wagtail/admin/locale/fa/LC_MESSAGES/django.po +11 -112
  73. wagtail/admin/locale/fa/LC_MESSAGES/djangojs.mo +0 -0
  74. wagtail/admin/locale/fa/LC_MESSAGES/djangojs.po +9 -2
  75. wagtail/admin/locale/fi/LC_MESSAGES/django.mo +0 -0
  76. wagtail/admin/locale/fi/LC_MESSAGES/django.po +34 -63
  77. wagtail/admin/locale/fi/LC_MESSAGES/djangojs.mo +0 -0
  78. wagtail/admin/locale/fi/LC_MESSAGES/djangojs.po +9 -3
  79. wagtail/admin/locale/fr/LC_MESSAGES/django.mo +0 -0
  80. wagtail/admin/locale/fr/LC_MESSAGES/django.po +139 -134
  81. wagtail/admin/locale/fr/LC_MESSAGES/djangojs.mo +0 -0
  82. wagtail/admin/locale/fr/LC_MESSAGES/djangojs.po +8 -2
  83. wagtail/admin/locale/gl/LC_MESSAGES/django.mo +0 -0
  84. wagtail/admin/locale/gl/LC_MESSAGES/django.po +130 -121
  85. wagtail/admin/locale/gl/LC_MESSAGES/djangojs.mo +0 -0
  86. wagtail/admin/locale/gl/LC_MESSAGES/djangojs.po +8 -2
  87. wagtail/admin/locale/he_IL/LC_MESSAGES/django.mo +0 -0
  88. wagtail/admin/locale/he_IL/LC_MESSAGES/django.po +5 -9
  89. wagtail/admin/locale/he_IL/LC_MESSAGES/djangojs.mo +0 -0
  90. wagtail/admin/locale/he_IL/LC_MESSAGES/djangojs.po +7 -4
  91. wagtail/admin/locale/hr_HR/LC_MESSAGES/django.mo +0 -0
  92. wagtail/admin/locale/hr_HR/LC_MESSAGES/django.po +31 -38
  93. wagtail/admin/locale/hr_HR/LC_MESSAGES/djangojs.mo +0 -0
  94. wagtail/admin/locale/hr_HR/LC_MESSAGES/djangojs.po +10 -4
  95. wagtail/admin/locale/ht/LC_MESSAGES/django.po +1 -1
  96. wagtail/admin/locale/hu/LC_MESSAGES/django.mo +0 -0
  97. wagtail/admin/locale/hu/LC_MESSAGES/django.po +340 -115
  98. wagtail/admin/locale/hu/LC_MESSAGES/djangojs.mo +0 -0
  99. wagtail/admin/locale/hu/LC_MESSAGES/djangojs.po +13 -2
  100. wagtail/admin/locale/id_ID/LC_MESSAGES/django.mo +0 -0
  101. wagtail/admin/locale/id_ID/LC_MESSAGES/django.po +12 -27
  102. wagtail/admin/locale/id_ID/LC_MESSAGES/djangojs.mo +0 -0
  103. wagtail/admin/locale/id_ID/LC_MESSAGES/djangojs.po +5 -1
  104. wagtail/admin/locale/is_IS/LC_MESSAGES/django.mo +0 -0
  105. wagtail/admin/locale/is_IS/LC_MESSAGES/django.po +35 -144
  106. wagtail/admin/locale/is_IS/LC_MESSAGES/djangojs.mo +0 -0
  107. wagtail/admin/locale/is_IS/LC_MESSAGES/djangojs.po +11 -5
  108. wagtail/admin/locale/it/LC_MESSAGES/django.mo +0 -0
  109. wagtail/admin/locale/it/LC_MESSAGES/django.po +38 -164
  110. wagtail/admin/locale/it/LC_MESSAGES/djangojs.mo +0 -0
  111. wagtail/admin/locale/it/LC_MESSAGES/djangojs.po +9 -3
  112. wagtail/admin/locale/ja/LC_MESSAGES/django.mo +0 -0
  113. wagtail/admin/locale/ja/LC_MESSAGES/django.po +15 -40
  114. wagtail/admin/locale/ja/LC_MESSAGES/djangojs.mo +0 -0
  115. wagtail/admin/locale/ja/LC_MESSAGES/djangojs.po +9 -2
  116. wagtail/admin/locale/ka/LC_MESSAGES/django.po +1 -1
  117. wagtail/admin/locale/ko/LC_MESSAGES/django.mo +0 -0
  118. wagtail/admin/locale/ko/LC_MESSAGES/django.po +96 -114
  119. wagtail/admin/locale/ko/LC_MESSAGES/djangojs.mo +0 -0
  120. wagtail/admin/locale/ko/LC_MESSAGES/djangojs.po +21 -2
  121. wagtail/admin/locale/lt/LC_MESSAGES/django.mo +0 -0
  122. wagtail/admin/locale/lt/LC_MESSAGES/django.po +31 -40
  123. wagtail/admin/locale/lt/LC_MESSAGES/djangojs.mo +0 -0
  124. wagtail/admin/locale/lt/LC_MESSAGES/djangojs.po +8 -2
  125. wagtail/admin/locale/lv/LC_MESSAGES/django.mo +0 -0
  126. wagtail/admin/locale/lv/LC_MESSAGES/django.po +10 -13
  127. wagtail/admin/locale/lv/LC_MESSAGES/djangojs.mo +0 -0
  128. wagtail/admin/locale/lv/LC_MESSAGES/djangojs.po +8 -2
  129. wagtail/admin/locale/mi/LC_MESSAGES/django.po +1 -1
  130. wagtail/admin/locale/mi/LC_MESSAGES/djangojs.mo +0 -0
  131. wagtail/admin/locale/mi/LC_MESSAGES/djangojs.po +8 -2
  132. wagtail/admin/locale/mn/LC_MESSAGES/django.mo +0 -0
  133. wagtail/admin/locale/mn/LC_MESSAGES/django.po +14 -24
  134. wagtail/admin/locale/mn/LC_MESSAGES/djangojs.mo +0 -0
  135. wagtail/admin/locale/mn/LC_MESSAGES/djangojs.po +5 -2
  136. wagtail/admin/locale/my/LC_MESSAGES/django.po +1 -1
  137. wagtail/admin/locale/nb/LC_MESSAGES/django.mo +0 -0
  138. wagtail/admin/locale/nb/LC_MESSAGES/django.po +32 -37
  139. wagtail/admin/locale/nb/LC_MESSAGES/djangojs.mo +0 -0
  140. wagtail/admin/locale/nb/LC_MESSAGES/djangojs.po +11 -4
  141. wagtail/admin/locale/nl/LC_MESSAGES/django.mo +0 -0
  142. wagtail/admin/locale/nl/LC_MESSAGES/django.po +102 -132
  143. wagtail/admin/locale/nl/LC_MESSAGES/djangojs.mo +0 -0
  144. wagtail/admin/locale/nl/LC_MESSAGES/djangojs.po +9 -3
  145. wagtail/admin/locale/pl/LC_MESSAGES/django.mo +0 -0
  146. wagtail/admin/locale/pl/LC_MESSAGES/django.po +38 -106
  147. wagtail/admin/locale/pl/LC_MESSAGES/djangojs.mo +0 -0
  148. wagtail/admin/locale/pl/LC_MESSAGES/djangojs.po +8 -2
  149. wagtail/admin/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
  150. wagtail/admin/locale/pt_BR/LC_MESSAGES/django.po +38 -151
  151. wagtail/admin/locale/pt_BR/LC_MESSAGES/djangojs.mo +0 -0
  152. wagtail/admin/locale/pt_BR/LC_MESSAGES/djangojs.po +10 -4
  153. wagtail/admin/locale/pt_PT/LC_MESSAGES/django.mo +0 -0
  154. wagtail/admin/locale/pt_PT/LC_MESSAGES/django.po +32 -137
  155. wagtail/admin/locale/pt_PT/LC_MESSAGES/djangojs.mo +0 -0
  156. wagtail/admin/locale/pt_PT/LC_MESSAGES/djangojs.po +9 -3
  157. wagtail/admin/locale/ro/LC_MESSAGES/django.mo +0 -0
  158. wagtail/admin/locale/ro/LC_MESSAGES/django.po +35 -161
  159. wagtail/admin/locale/ro/LC_MESSAGES/djangojs.mo +0 -0
  160. wagtail/admin/locale/ro/LC_MESSAGES/djangojs.po +9 -3
  161. wagtail/admin/locale/ru/LC_MESSAGES/django.mo +0 -0
  162. wagtail/admin/locale/ru/LC_MESSAGES/django.po +100 -157
  163. wagtail/admin/locale/ru/LC_MESSAGES/djangojs.mo +0 -0
  164. wagtail/admin/locale/ru/LC_MESSAGES/djangojs.po +9 -3
  165. wagtail/admin/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
  166. wagtail/admin/locale/sk_SK/LC_MESSAGES/django.po +6 -17
  167. wagtail/admin/locale/sk_SK/LC_MESSAGES/djangojs.mo +0 -0
  168. wagtail/admin/locale/sk_SK/LC_MESSAGES/djangojs.po +10 -4
  169. wagtail/admin/locale/sl/LC_MESSAGES/django.mo +0 -0
  170. wagtail/admin/locale/sl/LC_MESSAGES/django.po +36 -77
  171. wagtail/admin/locale/sl/LC_MESSAGES/djangojs.mo +0 -0
  172. wagtail/admin/locale/sl/LC_MESSAGES/djangojs.po +8 -2
  173. wagtail/admin/locale/sv/LC_MESSAGES/django.mo +0 -0
  174. wagtail/admin/locale/sv/LC_MESSAGES/django.po +35 -129
  175. wagtail/admin/locale/sv/LC_MESSAGES/djangojs.mo +0 -0
  176. wagtail/admin/locale/sv/LC_MESSAGES/djangojs.po +9 -3
  177. wagtail/admin/locale/tet/LC_MESSAGES/django.mo +0 -0
  178. wagtail/admin/locale/tet/LC_MESSAGES/django.po +6 -21
  179. wagtail/admin/locale/tet/LC_MESSAGES/djangojs.mo +0 -0
  180. wagtail/admin/locale/tet/LC_MESSAGES/djangojs.po +9 -3
  181. wagtail/admin/locale/th/LC_MESSAGES/django.mo +0 -0
  182. wagtail/admin/locale/th/LC_MESSAGES/django.po +11 -33
  183. wagtail/admin/locale/th/LC_MESSAGES/djangojs.mo +0 -0
  184. wagtail/admin/locale/th/LC_MESSAGES/djangojs.po +5 -2
  185. wagtail/admin/locale/tr/LC_MESSAGES/django.mo +0 -0
  186. wagtail/admin/locale/tr/LC_MESSAGES/django.po +29 -29
  187. wagtail/admin/locale/tr/LC_MESSAGES/djangojs.mo +0 -0
  188. wagtail/admin/locale/tr/LC_MESSAGES/djangojs.po +9 -3
  189. wagtail/admin/locale/tr_TR/LC_MESSAGES/django.mo +0 -0
  190. wagtail/admin/locale/tr_TR/LC_MESSAGES/django.po +29 -29
  191. wagtail/admin/locale/tr_TR/LC_MESSAGES/djangojs.mo +0 -0
  192. wagtail/admin/locale/tr_TR/LC_MESSAGES/djangojs.po +11 -4
  193. wagtail/admin/locale/ug/LC_MESSAGES/django.mo +0 -0
  194. wagtail/admin/locale/ug/LC_MESSAGES/django.po +17 -134
  195. wagtail/admin/locale/ug/LC_MESSAGES/djangojs.mo +0 -0
  196. wagtail/admin/locale/ug/LC_MESSAGES/djangojs.po +8 -2
  197. wagtail/admin/locale/uk/LC_MESSAGES/django.mo +0 -0
  198. wagtail/admin/locale/uk/LC_MESSAGES/django.po +31 -161
  199. wagtail/admin/locale/uk/LC_MESSAGES/djangojs.mo +0 -0
  200. wagtail/admin/locale/uk/LC_MESSAGES/djangojs.po +10 -4
  201. wagtail/admin/locale/vi/LC_MESSAGES/django.mo +0 -0
  202. wagtail/admin/locale/vi/LC_MESSAGES/django.po +2 -8
  203. wagtail/admin/locale/vi/LC_MESSAGES/djangojs.mo +0 -0
  204. wagtail/admin/locale/vi/LC_MESSAGES/djangojs.po +5 -2
  205. wagtail/admin/locale/zh/LC_MESSAGES/django.mo +0 -0
  206. wagtail/admin/locale/zh/LC_MESSAGES/django.po +2 -6
  207. wagtail/admin/locale/zh/LC_MESSAGES/djangojs.mo +0 -0
  208. wagtail/admin/locale/zh/LC_MESSAGES/djangojs.po +5 -2
  209. wagtail/admin/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  210. wagtail/admin/locale/zh_Hans/LC_MESSAGES/django.po +38 -112
  211. wagtail/admin/locale/zh_Hans/LC_MESSAGES/djangojs.mo +0 -0
  212. wagtail/admin/locale/zh_Hans/LC_MESSAGES/djangojs.po +11 -5
  213. wagtail/admin/locale/zh_Hant/LC_MESSAGES/django.mo +0 -0
  214. wagtail/admin/locale/zh_Hant/LC_MESSAGES/django.po +12 -33
  215. wagtail/admin/locale/zh_Hant/LC_MESSAGES/djangojs.mo +0 -0
  216. wagtail/admin/locale/zh_Hant/LC_MESSAGES/djangojs.po +10 -4
  217. wagtail/admin/localization.py +42 -1
  218. wagtail/admin/menu.py +1 -10
  219. wagtail/admin/paginator.py +95 -0
  220. wagtail/admin/panels/field_panel.py +27 -6
  221. wagtail/admin/panels/inline_panel.py +28 -11
  222. wagtail/admin/panels/multiple_chooser_panel.py +3 -3
  223. wagtail/admin/rich_text/converters/html_to_contentstate.py +6 -6
  224. wagtail/admin/search.py +1 -10
  225. wagtail/admin/static/wagtailadmin/css/core.css +1 -1
  226. wagtail/admin/static/wagtailadmin/css/panels/draftail.css +1 -1
  227. wagtail/admin/static/wagtailadmin/js/bulk-actions.js +1 -1
  228. wagtail/admin/static/wagtailadmin/js/comments.js +1 -1
  229. wagtail/admin/static/wagtailadmin/js/core.js +1 -1
  230. wagtail/admin/static/wagtailadmin/js/draftail.js +1 -1
  231. wagtail/admin/static/wagtailadmin/js/sidebar.js +1 -1
  232. wagtail/admin/static/wagtailadmin/js/telepath/blocks.js +1 -1
  233. wagtail/admin/static/wagtailadmin/js/telepath/widgets.js +1 -1
  234. wagtail/admin/static/wagtailadmin/js/vendor.js +1 -1
  235. wagtail/admin/static/wagtailadmin/js/vendor.js.LICENSE.txt +32 -11
  236. wagtail/admin/static/wagtailadmin/js/wagtailadmin.js +1 -1
  237. wagtail/admin/static/wagtailadmin/js/workflow-action.js +1 -1
  238. wagtail/admin/templates/wagtailadmin/admin_base.html +1 -0
  239. wagtail/admin/templates/wagtailadmin/generic/index.html +7 -2
  240. wagtail/admin/templates/wagtailadmin/home/upgrade_notification.html +1 -0
  241. wagtail/admin/templates/wagtailadmin/pages/_editor_js.html +2 -3
  242. wagtail/admin/templates/wagtailadmin/pages/action_menu/publish.html +2 -2
  243. wagtail/admin/templates/wagtailadmin/pages/bulk_actions/confirm_bulk_move.html +0 -1
  244. wagtail/admin/templates/wagtailadmin/pages/move_choose_destination.html +0 -1
  245. wagtail/admin/templates/wagtailadmin/panels/publishing/schedule_publishing_panel.html +1 -1
  246. wagtail/admin/templates/wagtailadmin/shared/active_filters.html +8 -1
  247. wagtail/admin/templates/wagtailadmin/shared/pagination_nav.html +25 -13
  248. wagtail/admin/templates/wagtailadmin/shared/side_panels/includes/status/privacy.html +1 -2
  249. wagtail/admin/templates/wagtailadmin/shared/side_panels/includes/status/workflow.html +1 -1
  250. wagtail/admin/templates/wagtailadmin/skeleton.html +2 -1
  251. wagtail/admin/templates/wagtailadmin/tables/locale_cell.html +4 -0
  252. wagtail/admin/templates/wagtailadmin/userbar/base.html +10 -8
  253. wagtail/admin/templatetags/wagtailadmin_tags.py +57 -132
  254. wagtail/admin/tests/pages/test_bulk_actions/test_bulk_move.py +31 -0
  255. wagtail/admin/tests/pages/test_create_page.py +627 -0
  256. wagtail/admin/tests/pages/test_edit_page.py +102 -18
  257. wagtail/admin/tests/pages/test_explorer_view.py +55 -26
  258. wagtail/admin/tests/pages/test_page_search.py +10 -0
  259. wagtail/admin/tests/pages/test_page_usage.py +2 -1
  260. wagtail/admin/tests/pages/test_preview.py +176 -36
  261. wagtail/admin/tests/pages/test_revisions.py +4 -7
  262. wagtail/admin/tests/test_account_management.py +1 -1
  263. wagtail/admin/tests/test_admin_search.py +1 -0
  264. wagtail/admin/tests/test_block_preview.py +4 -0
  265. wagtail/admin/tests/test_buttons_hooks.py +9 -145
  266. wagtail/admin/tests/test_collections_views.py +60 -0
  267. wagtail/admin/tests/test_contentstate.py +1 -1
  268. wagtail/admin/tests/test_dashboard.py +25 -0
  269. wagtail/admin/tests/test_edit_handlers.py +64 -0
  270. wagtail/admin/tests/test_forms.py +38 -0
  271. wagtail/admin/tests/test_keyboard_shortcuts.py +141 -5
  272. wagtail/admin/tests/test_page_chooser.py +2 -2
  273. wagtail/admin/tests/test_paginator.py +86 -0
  274. wagtail/admin/tests/test_privacy.py +12 -1
  275. wagtail/admin/tests/test_reports_views.py +8 -43
  276. wagtail/admin/tests/test_rich_text.py +14 -0
  277. wagtail/admin/tests/test_templatetags.py +50 -36
  278. wagtail/admin/tests/test_upgrade_notification.py +3 -0
  279. wagtail/admin/tests/test_userbar.py +79 -15
  280. wagtail/admin/tests/test_views.py +16 -1
  281. wagtail/admin/tests/test_widgets.py +47 -8
  282. wagtail/admin/tests/test_workflows.py +119 -6
  283. wagtail/admin/tests/tests.py +16 -15
  284. wagtail/admin/tests/ui/test_sidebar.py +0 -27
  285. wagtail/admin/tests/viewsets/test_chooser_viewset.py +38 -4
  286. wagtail/admin/tests/viewsets/test_model_viewset.py +1 -37
  287. wagtail/admin/ui/side_panels.py +14 -16
  288. wagtail/admin/ui/sidebar.py +5 -37
  289. wagtail/admin/ui/tables/__init__.py +34 -2
  290. wagtail/admin/ui/tables/pages.py +9 -0
  291. wagtail/admin/urls/__init__.py +2 -2
  292. wagtail/admin/urls/pages.py +3 -1
  293. wagtail/admin/userbar.py +3 -5
  294. wagtail/admin/utils.py +43 -4
  295. wagtail/admin/views/generic/base.py +16 -115
  296. wagtail/admin/views/generic/chooser.py +25 -8
  297. wagtail/admin/views/generic/mixins.py +45 -11
  298. wagtail/admin/views/generic/models.py +15 -30
  299. wagtail/admin/views/generic/preview.py +11 -3
  300. wagtail/admin/views/generic/workflow.py +11 -1
  301. wagtail/admin/views/i18n.py +14 -0
  302. wagtail/admin/views/pages/bulk_actions/move.py +1 -1
  303. wagtail/admin/views/pages/create.py +68 -6
  304. wagtail/admin/views/pages/edit.py +33 -14
  305. wagtail/admin/views/pages/listing.py +3 -2
  306. wagtail/admin/views/pages/move.py +43 -29
  307. wagtail/admin/views/pages/preview.py +15 -2
  308. wagtail/admin/views/pages/search.py +3 -0
  309. wagtail/admin/views/reports/base.py +0 -22
  310. wagtail/admin/views/reports/page_types_usage.py +2 -1
  311. wagtail/admin/views/tags.py +3 -1
  312. wagtail/admin/views/workflows.py +0 -3
  313. wagtail/admin/viewsets/model.py +5 -48
  314. wagtail/admin/wagtail_hooks.py +16 -17
  315. wagtail/admin/widgets/button.py +3 -33
  316. wagtail/admin/widgets/tags.py +31 -3
  317. wagtail/api/v2/views.py +4 -4
  318. wagtail/blocks/base.py +78 -34
  319. wagtail/blocks/field_block.py +2 -1
  320. wagtail/blocks/list_block.py +2 -1
  321. wagtail/blocks/migrations/operations.py +10 -10
  322. wagtail/blocks/stream_block.py +19 -11
  323. wagtail/blocks/struct_block.py +4 -0
  324. wagtail/compat.py +17 -1
  325. wagtail/contrib/forms/forms.py +64 -31
  326. wagtail/contrib/forms/locale/af/LC_MESSAGES/django.po +1 -1
  327. wagtail/contrib/forms/locale/ar/LC_MESSAGES/django.mo +0 -0
  328. wagtail/contrib/forms/locale/ar/LC_MESSAGES/django.po +1 -7
  329. wagtail/contrib/forms/locale/az_AZ/LC_MESSAGES/django.po +1 -1
  330. wagtail/contrib/forms/locale/be/LC_MESSAGES/django.mo +0 -0
  331. wagtail/contrib/forms/locale/be/LC_MESSAGES/django.po +1 -7
  332. wagtail/contrib/forms/locale/bg/LC_MESSAGES/django.po +1 -1
  333. wagtail/contrib/forms/locale/bn/LC_MESSAGES/django.po +1 -1
  334. wagtail/contrib/forms/locale/ca/LC_MESSAGES/django.mo +0 -0
  335. wagtail/contrib/forms/locale/ca/LC_MESSAGES/django.po +15 -6
  336. wagtail/contrib/forms/locale/cs/LC_MESSAGES/django.mo +0 -0
  337. wagtail/contrib/forms/locale/cs/LC_MESSAGES/django.po +2 -9
  338. wagtail/contrib/forms/locale/cy/LC_MESSAGES/django.mo +0 -0
  339. wagtail/contrib/forms/locale/cy/LC_MESSAGES/django.po +2 -7
  340. wagtail/contrib/forms/locale/da/LC_MESSAGES/django.po +1 -1
  341. wagtail/contrib/forms/locale/de/LC_MESSAGES/django.mo +0 -0
  342. wagtail/contrib/forms/locale/de/LC_MESSAGES/django.po +3 -10
  343. wagtail/contrib/forms/locale/dv/LC_MESSAGES/django.po +2 -1
  344. wagtail/contrib/forms/locale/el/LC_MESSAGES/django.mo +0 -0
  345. wagtail/contrib/forms/locale/el/LC_MESSAGES/django.po +1 -9
  346. wagtail/contrib/forms/locale/en/LC_MESSAGES/django.po +13 -6
  347. wagtail/contrib/forms/locale/es/LC_MESSAGES/django.mo +0 -0
  348. wagtail/contrib/forms/locale/es/LC_MESSAGES/django.po +1 -9
  349. wagtail/contrib/forms/locale/es_419/LC_MESSAGES/django.po +1 -1
  350. wagtail/contrib/forms/locale/et/LC_MESSAGES/django.mo +0 -0
  351. wagtail/contrib/forms/locale/et/LC_MESSAGES/django.po +1 -7
  352. wagtail/contrib/forms/locale/eu/LC_MESSAGES/django.po +1 -1
  353. wagtail/contrib/forms/locale/fa/LC_MESSAGES/django.mo +0 -0
  354. wagtail/contrib/forms/locale/fa/LC_MESSAGES/django.po +1 -7
  355. wagtail/contrib/forms/locale/fi/LC_MESSAGES/django.mo +0 -0
  356. wagtail/contrib/forms/locale/fi/LC_MESSAGES/django.po +1 -9
  357. wagtail/contrib/forms/locale/fr/LC_MESSAGES/django.mo +0 -0
  358. wagtail/contrib/forms/locale/fr/LC_MESSAGES/django.po +8 -6
  359. wagtail/contrib/forms/locale/gl/LC_MESSAGES/django.mo +0 -0
  360. wagtail/contrib/forms/locale/gl/LC_MESSAGES/django.po +17 -6
  361. wagtail/contrib/forms/locale/he_IL/LC_MESSAGES/django.po +1 -1
  362. wagtail/contrib/forms/locale/hr_HR/LC_MESSAGES/django.mo +0 -0
  363. wagtail/contrib/forms/locale/hr_HR/LC_MESSAGES/django.po +1 -9
  364. wagtail/contrib/forms/locale/ht/LC_MESSAGES/django.po +1 -1
  365. wagtail/contrib/forms/locale/hu/LC_MESSAGES/django.mo +0 -0
  366. wagtail/contrib/forms/locale/hu/LC_MESSAGES/django.po +1 -9
  367. wagtail/contrib/forms/locale/hy/LC_MESSAGES/django.po +1 -1
  368. wagtail/contrib/forms/locale/id_ID/LC_MESSAGES/django.mo +0 -0
  369. wagtail/contrib/forms/locale/id_ID/LC_MESSAGES/django.po +1 -9
  370. wagtail/contrib/forms/locale/is_IS/LC_MESSAGES/django.mo +0 -0
  371. wagtail/contrib/forms/locale/is_IS/LC_MESSAGES/django.po +1 -9
  372. wagtail/contrib/forms/locale/it/LC_MESSAGES/django.mo +0 -0
  373. wagtail/contrib/forms/locale/it/LC_MESSAGES/django.po +1 -7
  374. wagtail/contrib/forms/locale/ja/LC_MESSAGES/django.mo +0 -0
  375. wagtail/contrib/forms/locale/ja/LC_MESSAGES/django.po +1 -9
  376. wagtail/contrib/forms/locale/ka/LC_MESSAGES/django.po +1 -1
  377. wagtail/contrib/forms/locale/ko/LC_MESSAGES/django.mo +0 -0
  378. wagtail/contrib/forms/locale/ko/LC_MESSAGES/django.po +1 -9
  379. wagtail/contrib/forms/locale/lt/LC_MESSAGES/django.mo +0 -0
  380. wagtail/contrib/forms/locale/lt/LC_MESSAGES/django.po +1 -8
  381. wagtail/contrib/forms/locale/lv/LC_MESSAGES/django.po +1 -1
  382. wagtail/contrib/forms/locale/mi/LC_MESSAGES/django.po +1 -1
  383. wagtail/contrib/forms/locale/mn/LC_MESSAGES/django.mo +0 -0
  384. wagtail/contrib/forms/locale/mn/LC_MESSAGES/django.po +3 -2
  385. wagtail/contrib/forms/locale/my/LC_MESSAGES/django.mo +0 -0
  386. wagtail/contrib/forms/locale/my/LC_MESSAGES/django.po +1 -7
  387. wagtail/contrib/forms/locale/nb/LC_MESSAGES/django.mo +0 -0
  388. wagtail/contrib/forms/locale/nb/LC_MESSAGES/django.po +1 -8
  389. wagtail/contrib/forms/locale/nl/LC_MESSAGES/django.mo +0 -0
  390. wagtail/contrib/forms/locale/nl/LC_MESSAGES/django.po +2 -10
  391. wagtail/contrib/forms/locale/pl/LC_MESSAGES/django.mo +0 -0
  392. wagtail/contrib/forms/locale/pl/LC_MESSAGES/django.po +2 -8
  393. wagtail/contrib/forms/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
  394. wagtail/contrib/forms/locale/pt_BR/LC_MESSAGES/django.po +2 -8
  395. wagtail/contrib/forms/locale/pt_PT/LC_MESSAGES/django.mo +0 -0
  396. wagtail/contrib/forms/locale/pt_PT/LC_MESSAGES/django.po +1 -8
  397. wagtail/contrib/forms/locale/ro/LC_MESSAGES/django.mo +0 -0
  398. wagtail/contrib/forms/locale/ro/LC_MESSAGES/django.po +2 -8
  399. wagtail/contrib/forms/locale/ru/LC_MESSAGES/django.mo +0 -0
  400. wagtail/contrib/forms/locale/ru/LC_MESSAGES/django.po +2 -7
  401. wagtail/contrib/forms/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
  402. wagtail/contrib/forms/locale/sk_SK/LC_MESSAGES/django.po +1 -8
  403. wagtail/contrib/forms/locale/sl/LC_MESSAGES/django.mo +0 -0
  404. wagtail/contrib/forms/locale/sl/LC_MESSAGES/django.po +2 -8
  405. wagtail/contrib/forms/locale/sv/LC_MESSAGES/django.mo +0 -0
  406. wagtail/contrib/forms/locale/sv/LC_MESSAGES/django.po +1 -9
  407. wagtail/contrib/forms/locale/tet/LC_MESSAGES/django.mo +0 -0
  408. wagtail/contrib/forms/locale/tet/LC_MESSAGES/django.po +1 -9
  409. wagtail/contrib/forms/locale/th/LC_MESSAGES/django.mo +0 -0
  410. wagtail/contrib/forms/locale/th/LC_MESSAGES/django.po +1 -7
  411. wagtail/contrib/forms/locale/tr/LC_MESSAGES/django.mo +0 -0
  412. wagtail/contrib/forms/locale/tr/LC_MESSAGES/django.po +1 -7
  413. wagtail/contrib/forms/locale/tr_TR/LC_MESSAGES/django.mo +0 -0
  414. wagtail/contrib/forms/locale/tr_TR/LC_MESSAGES/django.po +1 -7
  415. wagtail/contrib/forms/locale/ug/LC_MESSAGES/django.mo +0 -0
  416. wagtail/contrib/forms/locale/ug/LC_MESSAGES/django.po +1 -7
  417. wagtail/contrib/forms/locale/uk/LC_MESSAGES/django.mo +0 -0
  418. wagtail/contrib/forms/locale/uk/LC_MESSAGES/django.po +1 -7
  419. wagtail/contrib/forms/locale/vi/LC_MESSAGES/django.po +1 -1
  420. wagtail/contrib/forms/locale/zh/LC_MESSAGES/django.po +1 -1
  421. wagtail/contrib/forms/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  422. wagtail/contrib/forms/locale/zh_Hans/LC_MESSAGES/django.po +2 -8
  423. wagtail/contrib/forms/locale/zh_Hant/LC_MESSAGES/django.mo +0 -0
  424. wagtail/contrib/forms/locale/zh_Hant/LC_MESSAGES/django.po +1 -7
  425. wagtail/contrib/forms/tests/test_forms.py +62 -0
  426. wagtail/contrib/forms/tests/test_views.py +161 -5
  427. wagtail/contrib/frontend_cache/backends/cloudfront.py +1 -29
  428. wagtail/contrib/frontend_cache/tests.py +112 -52
  429. wagtail/contrib/frontend_cache/utils.py +109 -17
  430. wagtail/contrib/redirects/forms.py +3 -2
  431. wagtail/contrib/redirects/locale/ar/LC_MESSAGES/django.mo +0 -0
  432. wagtail/contrib/redirects/locale/ar/LC_MESSAGES/django.po +7 -16
  433. wagtail/contrib/redirects/locale/be/LC_MESSAGES/django.mo +0 -0
  434. wagtail/contrib/redirects/locale/be/LC_MESSAGES/django.po +1 -10
  435. wagtail/contrib/redirects/locale/bg/LC_MESSAGES/django.mo +0 -0
  436. wagtail/contrib/redirects/locale/bg/LC_MESSAGES/django.po +4 -13
  437. wagtail/contrib/redirects/locale/bn/LC_MESSAGES/django.mo +0 -0
  438. wagtail/contrib/redirects/locale/bn/LC_MESSAGES/django.po +1 -7
  439. wagtail/contrib/redirects/locale/ca/LC_MESSAGES/django.mo +0 -0
  440. wagtail/contrib/redirects/locale/ca/LC_MESSAGES/django.po +8 -17
  441. wagtail/contrib/redirects/locale/cs/LC_MESSAGES/django.mo +0 -0
  442. wagtail/contrib/redirects/locale/cs/LC_MESSAGES/django.po +7 -16
  443. wagtail/contrib/redirects/locale/cy/LC_MESSAGES/django.mo +0 -0
  444. wagtail/contrib/redirects/locale/cy/LC_MESSAGES/django.po +8 -16
  445. wagtail/contrib/redirects/locale/da/LC_MESSAGES/django.mo +0 -0
  446. wagtail/contrib/redirects/locale/da/LC_MESSAGES/django.po +1 -10
  447. wagtail/contrib/redirects/locale/de/LC_MESSAGES/django.mo +0 -0
  448. wagtail/contrib/redirects/locale/de/LC_MESSAGES/django.po +8 -16
  449. wagtail/contrib/redirects/locale/dv/LC_MESSAGES/django.mo +0 -0
  450. wagtail/contrib/redirects/locale/dv/LC_MESSAGES/django.po +2 -10
  451. wagtail/contrib/redirects/locale/el/LC_MESSAGES/django.mo +0 -0
  452. wagtail/contrib/redirects/locale/el/LC_MESSAGES/django.po +7 -16
  453. wagtail/contrib/redirects/locale/en/LC_MESSAGES/django.po +8 -8
  454. wagtail/contrib/redirects/locale/en_IN/LC_MESSAGES/django.po +1 -1
  455. wagtail/contrib/redirects/locale/es/LC_MESSAGES/django.mo +0 -0
  456. wagtail/contrib/redirects/locale/es/LC_MESSAGES/django.po +7 -16
  457. wagtail/contrib/redirects/locale/es_419/LC_MESSAGES/django.mo +0 -0
  458. wagtail/contrib/redirects/locale/es_419/LC_MESSAGES/django.po +1 -7
  459. wagtail/contrib/redirects/locale/es_VE/LC_MESSAGES/django.po +1 -1
  460. wagtail/contrib/redirects/locale/et/LC_MESSAGES/django.mo +0 -0
  461. wagtail/contrib/redirects/locale/et/LC_MESSAGES/django.po +7 -16
  462. wagtail/contrib/redirects/locale/eu/LC_MESSAGES/django.mo +0 -0
  463. wagtail/contrib/redirects/locale/eu/LC_MESSAGES/django.po +1 -4
  464. wagtail/contrib/redirects/locale/fa/LC_MESSAGES/django.mo +0 -0
  465. wagtail/contrib/redirects/locale/fa/LC_MESSAGES/django.po +9 -17
  466. wagtail/contrib/redirects/locale/fi/LC_MESSAGES/django.mo +0 -0
  467. wagtail/contrib/redirects/locale/fi/LC_MESSAGES/django.po +8 -17
  468. wagtail/contrib/redirects/locale/fr/LC_MESSAGES/django.mo +0 -0
  469. wagtail/contrib/redirects/locale/fr/LC_MESSAGES/django.po +9 -16
  470. wagtail/contrib/redirects/locale/gl/LC_MESSAGES/django.mo +0 -0
  471. wagtail/contrib/redirects/locale/gl/LC_MESSAGES/django.po +7 -16
  472. wagtail/contrib/redirects/locale/he_IL/LC_MESSAGES/django.mo +0 -0
  473. wagtail/contrib/redirects/locale/he_IL/LC_MESSAGES/django.po +7 -16
  474. wagtail/contrib/redirects/locale/hi/LC_MESSAGES/django.po +1 -1
  475. wagtail/contrib/redirects/locale/hr_HR/LC_MESSAGES/django.mo +0 -0
  476. wagtail/contrib/redirects/locale/hr_HR/LC_MESSAGES/django.po +7 -16
  477. wagtail/contrib/redirects/locale/ht/LC_MESSAGES/django.mo +0 -0
  478. wagtail/contrib/redirects/locale/ht/LC_MESSAGES/django.po +1 -4
  479. wagtail/contrib/redirects/locale/hu/LC_MESSAGES/django.mo +0 -0
  480. wagtail/contrib/redirects/locale/hu/LC_MESSAGES/django.po +7 -16
  481. wagtail/contrib/redirects/locale/hy/LC_MESSAGES/django.po +1 -1
  482. wagtail/contrib/redirects/locale/id_ID/LC_MESSAGES/django.mo +0 -0
  483. wagtail/contrib/redirects/locale/id_ID/LC_MESSAGES/django.po +7 -16
  484. wagtail/contrib/redirects/locale/is_IS/LC_MESSAGES/django.mo +0 -0
  485. wagtail/contrib/redirects/locale/is_IS/LC_MESSAGES/django.po +8 -17
  486. wagtail/contrib/redirects/locale/it/LC_MESSAGES/django.mo +0 -0
  487. wagtail/contrib/redirects/locale/it/LC_MESSAGES/django.po +7 -16
  488. wagtail/contrib/redirects/locale/ja/LC_MESSAGES/django.mo +0 -0
  489. wagtail/contrib/redirects/locale/ja/LC_MESSAGES/django.po +7 -16
  490. wagtail/contrib/redirects/locale/ka/LC_MESSAGES/django.mo +0 -0
  491. wagtail/contrib/redirects/locale/ka/LC_MESSAGES/django.po +1 -7
  492. wagtail/contrib/redirects/locale/ko/LC_MESSAGES/django.mo +0 -0
  493. wagtail/contrib/redirects/locale/ko/LC_MESSAGES/django.po +23 -16
  494. wagtail/contrib/redirects/locale/lt/LC_MESSAGES/django.mo +0 -0
  495. wagtail/contrib/redirects/locale/lt/LC_MESSAGES/django.po +7 -16
  496. wagtail/contrib/redirects/locale/lv/LC_MESSAGES/django.mo +0 -0
  497. wagtail/contrib/redirects/locale/lv/LC_MESSAGES/django.po +4 -13
  498. wagtail/contrib/redirects/locale/mi/LC_MESSAGES/django.mo +0 -0
  499. wagtail/contrib/redirects/locale/mi/LC_MESSAGES/django.po +4 -13
  500. wagtail/contrib/redirects/locale/mn/LC_MESSAGES/django.mo +0 -0
  501. wagtail/contrib/redirects/locale/mn/LC_MESSAGES/django.po +7 -16
  502. wagtail/contrib/redirects/locale/my/LC_MESSAGES/django.mo +0 -0
  503. wagtail/contrib/redirects/locale/my/LC_MESSAGES/django.po +3 -12
  504. wagtail/contrib/redirects/locale/nb/LC_MESSAGES/django.mo +0 -0
  505. wagtail/contrib/redirects/locale/nb/LC_MESSAGES/django.po +8 -16
  506. wagtail/contrib/redirects/locale/nl/LC_MESSAGES/django.mo +0 -0
  507. wagtail/contrib/redirects/locale/nl/LC_MESSAGES/django.po +8 -17
  508. wagtail/contrib/redirects/locale/pl/LC_MESSAGES/django.mo +0 -0
  509. wagtail/contrib/redirects/locale/pl/LC_MESSAGES/django.po +8 -17
  510. wagtail/contrib/redirects/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
  511. wagtail/contrib/redirects/locale/pt_BR/LC_MESSAGES/django.po +9 -17
  512. wagtail/contrib/redirects/locale/pt_PT/LC_MESSAGES/django.mo +0 -0
  513. wagtail/contrib/redirects/locale/pt_PT/LC_MESSAGES/django.po +7 -16
  514. wagtail/contrib/redirects/locale/ro/LC_MESSAGES/django.mo +0 -0
  515. wagtail/contrib/redirects/locale/ro/LC_MESSAGES/django.po +9 -17
  516. wagtail/contrib/redirects/locale/ru/LC_MESSAGES/django.mo +0 -0
  517. wagtail/contrib/redirects/locale/ru/LC_MESSAGES/django.po +9 -17
  518. wagtail/contrib/redirects/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
  519. wagtail/contrib/redirects/locale/sk_SK/LC_MESSAGES/django.po +7 -16
  520. wagtail/contrib/redirects/locale/sl/LC_MESSAGES/django.mo +0 -0
  521. wagtail/contrib/redirects/locale/sl/LC_MESSAGES/django.po +8 -17
  522. wagtail/contrib/redirects/locale/sr/LC_MESSAGES/django.po +1 -1
  523. wagtail/contrib/redirects/locale/sv/LC_MESSAGES/django.mo +0 -0
  524. wagtail/contrib/redirects/locale/sv/LC_MESSAGES/django.po +8 -17
  525. wagtail/contrib/redirects/locale/ta/LC_MESSAGES/django.po +1 -1
  526. wagtail/contrib/redirects/locale/tet/LC_MESSAGES/django.mo +0 -0
  527. wagtail/contrib/redirects/locale/tet/LC_MESSAGES/django.po +7 -16
  528. wagtail/contrib/redirects/locale/th/LC_MESSAGES/django.mo +0 -0
  529. wagtail/contrib/redirects/locale/th/LC_MESSAGES/django.po +7 -16
  530. wagtail/contrib/redirects/locale/tr/LC_MESSAGES/django.mo +0 -0
  531. wagtail/contrib/redirects/locale/tr/LC_MESSAGES/django.po +7 -16
  532. wagtail/contrib/redirects/locale/tr_TR/LC_MESSAGES/django.mo +0 -0
  533. wagtail/contrib/redirects/locale/tr_TR/LC_MESSAGES/django.po +7 -16
  534. wagtail/contrib/redirects/locale/ug/LC_MESSAGES/django.mo +0 -0
  535. wagtail/contrib/redirects/locale/ug/LC_MESSAGES/django.po +7 -16
  536. wagtail/contrib/redirects/locale/uk/LC_MESSAGES/django.mo +0 -0
  537. wagtail/contrib/redirects/locale/uk/LC_MESSAGES/django.po +9 -17
  538. wagtail/contrib/redirects/locale/vi/LC_MESSAGES/django.mo +0 -0
  539. wagtail/contrib/redirects/locale/vi/LC_MESSAGES/django.po +1 -10
  540. wagtail/contrib/redirects/locale/zh/LC_MESSAGES/django.mo +0 -0
  541. wagtail/contrib/redirects/locale/zh/LC_MESSAGES/django.po +4 -13
  542. wagtail/contrib/redirects/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  543. wagtail/contrib/redirects/locale/zh_Hans/LC_MESSAGES/django.po +8 -17
  544. wagtail/contrib/redirects/locale/zh_Hant/LC_MESSAGES/django.mo +0 -0
  545. wagtail/contrib/redirects/locale/zh_Hant/LC_MESSAGES/django.po +7 -16
  546. wagtail/contrib/redirects/tmp_storages.py +1 -0
  547. wagtail/contrib/routable_page/tests.py +3 -3
  548. wagtail/contrib/search_promotions/forms.py +3 -2
  549. wagtail/contrib/search_promotions/locale/af/LC_MESSAGES/django.mo +0 -0
  550. wagtail/contrib/search_promotions/locale/af/LC_MESSAGES/django.po +4 -1
  551. wagtail/contrib/search_promotions/locale/ar/LC_MESSAGES/django.mo +0 -0
  552. wagtail/contrib/search_promotions/locale/ar/LC_MESSAGES/django.po +15 -31
  553. wagtail/contrib/search_promotions/locale/az_AZ/LC_MESSAGES/django.mo +0 -0
  554. wagtail/contrib/search_promotions/locale/az_AZ/LC_MESSAGES/django.po +1 -4
  555. wagtail/contrib/search_promotions/locale/be/LC_MESSAGES/django.mo +0 -0
  556. wagtail/contrib/search_promotions/locale/be/LC_MESSAGES/django.po +15 -31
  557. wagtail/contrib/search_promotions/locale/bg/LC_MESSAGES/django.mo +0 -0
  558. wagtail/contrib/search_promotions/locale/bg/LC_MESSAGES/django.po +9 -22
  559. wagtail/contrib/search_promotions/locale/bn/LC_MESSAGES/django.mo +0 -0
  560. wagtail/contrib/search_promotions/locale/bn/LC_MESSAGES/django.po +1 -7
  561. wagtail/contrib/search_promotions/locale/ca/LC_MESSAGES/django.mo +0 -0
  562. wagtail/contrib/search_promotions/locale/ca/LC_MESSAGES/django.po +27 -37
  563. wagtail/contrib/search_promotions/locale/cs/LC_MESSAGES/django.mo +0 -0
  564. wagtail/contrib/search_promotions/locale/cs/LC_MESSAGES/django.po +15 -31
  565. wagtail/contrib/search_promotions/locale/cy/LC_MESSAGES/django.mo +0 -0
  566. wagtail/contrib/search_promotions/locale/cy/LC_MESSAGES/django.po +18 -37
  567. wagtail/contrib/search_promotions/locale/da/LC_MESSAGES/django.mo +0 -0
  568. wagtail/contrib/search_promotions/locale/da/LC_MESSAGES/django.po +9 -12
  569. wagtail/contrib/search_promotions/locale/de/LC_MESSAGES/django.mo +0 -0
  570. wagtail/contrib/search_promotions/locale/de/LC_MESSAGES/django.po +27 -37
  571. wagtail/contrib/search_promotions/locale/dv/LC_MESSAGES/django.mo +0 -0
  572. wagtail/contrib/search_promotions/locale/dv/LC_MESSAGES/django.po +10 -12
  573. wagtail/contrib/search_promotions/locale/el/LC_MESSAGES/django.mo +0 -0
  574. wagtail/contrib/search_promotions/locale/el/LC_MESSAGES/django.po +14 -30
  575. wagtail/contrib/search_promotions/locale/en/LC_MESSAGES/django.po +19 -23
  576. wagtail/contrib/search_promotions/locale/es/LC_MESSAGES/django.mo +0 -0
  577. wagtail/contrib/search_promotions/locale/es/LC_MESSAGES/django.po +15 -31
  578. wagtail/contrib/search_promotions/locale/es_419/LC_MESSAGES/django.mo +0 -0
  579. wagtail/contrib/search_promotions/locale/es_419/LC_MESSAGES/django.po +1 -7
  580. wagtail/contrib/search_promotions/locale/et/LC_MESSAGES/django.mo +0 -0
  581. wagtail/contrib/search_promotions/locale/et/LC_MESSAGES/django.po +15 -31
  582. wagtail/contrib/search_promotions/locale/eu/LC_MESSAGES/django.mo +0 -0
  583. wagtail/contrib/search_promotions/locale/eu/LC_MESSAGES/django.po +7 -4
  584. wagtail/contrib/search_promotions/locale/fa/LC_MESSAGES/django.mo +0 -0
  585. wagtail/contrib/search_promotions/locale/fa/LC_MESSAGES/django.po +15 -31
  586. wagtail/contrib/search_promotions/locale/fi/LC_MESSAGES/django.mo +0 -0
  587. wagtail/contrib/search_promotions/locale/fi/LC_MESSAGES/django.po +15 -31
  588. wagtail/contrib/search_promotions/locale/fr/LC_MESSAGES/django.mo +0 -0
  589. wagtail/contrib/search_promotions/locale/fr/LC_MESSAGES/django.po +28 -38
  590. wagtail/contrib/search_promotions/locale/gl/LC_MESSAGES/django.mo +0 -0
  591. wagtail/contrib/search_promotions/locale/gl/LC_MESSAGES/django.po +29 -39
  592. wagtail/contrib/search_promotions/locale/he_IL/LC_MESSAGES/django.mo +0 -0
  593. wagtail/contrib/search_promotions/locale/he_IL/LC_MESSAGES/django.po +12 -19
  594. wagtail/contrib/search_promotions/locale/hr_HR/LC_MESSAGES/django.mo +0 -0
  595. wagtail/contrib/search_promotions/locale/hr_HR/LC_MESSAGES/django.po +21 -37
  596. wagtail/contrib/search_promotions/locale/ht/LC_MESSAGES/django.mo +0 -0
  597. wagtail/contrib/search_promotions/locale/ht/LC_MESSAGES/django.po +3 -9
  598. wagtail/contrib/search_promotions/locale/hu/LC_MESSAGES/django.mo +0 -0
  599. wagtail/contrib/search_promotions/locale/hu/LC_MESSAGES/django.po +31 -38
  600. wagtail/contrib/search_promotions/locale/id_ID/LC_MESSAGES/django.mo +0 -0
  601. wagtail/contrib/search_promotions/locale/id_ID/LC_MESSAGES/django.po +15 -31
  602. wagtail/contrib/search_promotions/locale/is_IS/LC_MESSAGES/django.mo +0 -0
  603. wagtail/contrib/search_promotions/locale/is_IS/LC_MESSAGES/django.po +20 -36
  604. wagtail/contrib/search_promotions/locale/it/LC_MESSAGES/django.mo +0 -0
  605. wagtail/contrib/search_promotions/locale/it/LC_MESSAGES/django.po +18 -34
  606. wagtail/contrib/search_promotions/locale/ja/LC_MESSAGES/django.mo +0 -0
  607. wagtail/contrib/search_promotions/locale/ja/LC_MESSAGES/django.po +14 -30
  608. wagtail/contrib/search_promotions/locale/ka/LC_MESSAGES/django.mo +0 -0
  609. wagtail/contrib/search_promotions/locale/ka/LC_MESSAGES/django.po +3 -6
  610. wagtail/contrib/search_promotions/locale/ko/LC_MESSAGES/django.mo +0 -0
  611. wagtail/contrib/search_promotions/locale/ko/LC_MESSAGES/django.po +18 -30
  612. wagtail/contrib/search_promotions/locale/lt/LC_MESSAGES/django.mo +0 -0
  613. wagtail/contrib/search_promotions/locale/lt/LC_MESSAGES/django.po +15 -31
  614. wagtail/contrib/search_promotions/locale/lv/LC_MESSAGES/django.mo +0 -0
  615. wagtail/contrib/search_promotions/locale/lv/LC_MESSAGES/django.po +9 -22
  616. wagtail/contrib/search_promotions/locale/mi/LC_MESSAGES/django.mo +0 -0
  617. wagtail/contrib/search_promotions/locale/mi/LC_MESSAGES/django.po +6 -25
  618. wagtail/contrib/search_promotions/locale/mn/LC_MESSAGES/django.mo +0 -0
  619. wagtail/contrib/search_promotions/locale/mn/LC_MESSAGES/django.po +9 -22
  620. wagtail/contrib/search_promotions/locale/my/LC_MESSAGES/django.mo +0 -0
  621. wagtail/contrib/search_promotions/locale/my/LC_MESSAGES/django.po +3 -12
  622. wagtail/contrib/search_promotions/locale/nb/LC_MESSAGES/django.mo +0 -0
  623. wagtail/contrib/search_promotions/locale/nb/LC_MESSAGES/django.po +14 -30
  624. wagtail/contrib/search_promotions/locale/nl/LC_MESSAGES/django.mo +0 -0
  625. wagtail/contrib/search_promotions/locale/nl/LC_MESSAGES/django.po +27 -37
  626. wagtail/contrib/search_promotions/locale/pl/LC_MESSAGES/django.mo +0 -0
  627. wagtail/contrib/search_promotions/locale/pl/LC_MESSAGES/django.po +17 -33
  628. wagtail/contrib/search_promotions/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
  629. wagtail/contrib/search_promotions/locale/pt_BR/LC_MESSAGES/django.po +18 -34
  630. wagtail/contrib/search_promotions/locale/pt_PT/LC_MESSAGES/django.mo +0 -0
  631. wagtail/contrib/search_promotions/locale/pt_PT/LC_MESSAGES/django.po +15 -31
  632. wagtail/contrib/search_promotions/locale/ro/LC_MESSAGES/django.mo +0 -0
  633. wagtail/contrib/search_promotions/locale/ro/LC_MESSAGES/django.po +21 -37
  634. wagtail/contrib/search_promotions/locale/ru/LC_MESSAGES/django.mo +0 -0
  635. wagtail/contrib/search_promotions/locale/ru/LC_MESSAGES/django.po +29 -39
  636. wagtail/contrib/search_promotions/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
  637. wagtail/contrib/search_promotions/locale/sk_SK/LC_MESSAGES/django.po +12 -31
  638. wagtail/contrib/search_promotions/locale/sl/LC_MESSAGES/django.mo +0 -0
  639. wagtail/contrib/search_promotions/locale/sl/LC_MESSAGES/django.po +21 -37
  640. wagtail/contrib/search_promotions/locale/sv/LC_MESSAGES/django.mo +0 -0
  641. wagtail/contrib/search_promotions/locale/sv/LC_MESSAGES/django.po +15 -31
  642. wagtail/contrib/search_promotions/locale/tet/LC_MESSAGES/django.mo +0 -0
  643. wagtail/contrib/search_promotions/locale/tet/LC_MESSAGES/django.po +15 -28
  644. wagtail/contrib/search_promotions/locale/th/LC_MESSAGES/django.mo +0 -0
  645. wagtail/contrib/search_promotions/locale/th/LC_MESSAGES/django.po +15 -31
  646. wagtail/contrib/search_promotions/locale/tr/LC_MESSAGES/django.mo +0 -0
  647. wagtail/contrib/search_promotions/locale/tr/LC_MESSAGES/django.po +15 -31
  648. wagtail/contrib/search_promotions/locale/tr_TR/LC_MESSAGES/django.mo +0 -0
  649. wagtail/contrib/search_promotions/locale/tr_TR/LC_MESSAGES/django.po +15 -31
  650. wagtail/contrib/search_promotions/locale/ug/LC_MESSAGES/django.mo +0 -0
  651. wagtail/contrib/search_promotions/locale/ug/LC_MESSAGES/django.po +17 -36
  652. wagtail/contrib/search_promotions/locale/uk/LC_MESSAGES/django.mo +0 -0
  653. wagtail/contrib/search_promotions/locale/uk/LC_MESSAGES/django.po +15 -31
  654. wagtail/contrib/search_promotions/locale/vi/LC_MESSAGES/django.mo +0 -0
  655. wagtail/contrib/search_promotions/locale/vi/LC_MESSAGES/django.po +3 -12
  656. wagtail/contrib/search_promotions/locale/zh/LC_MESSAGES/django.mo +0 -0
  657. wagtail/contrib/search_promotions/locale/zh/LC_MESSAGES/django.po +9 -22
  658. wagtail/contrib/search_promotions/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  659. wagtail/contrib/search_promotions/locale/zh_Hans/LC_MESSAGES/django.po +15 -31
  660. wagtail/contrib/search_promotions/locale/zh_Hant/LC_MESSAGES/django.mo +0 -0
  661. wagtail/contrib/search_promotions/locale/zh_Hant/LC_MESSAGES/django.po +15 -31
  662. wagtail/contrib/search_promotions/models.py +1 -7
  663. wagtail/contrib/search_promotions/templates/wagtailsearchpromotions/queries/chooser/results.html +1 -1
  664. wagtail/contrib/search_promotions/tests.py +4 -5
  665. wagtail/contrib/search_promotions/views/settings.py +1 -2
  666. wagtail/contrib/settings/locale/ar/LC_MESSAGES/django.po +1 -1
  667. wagtail/contrib/settings/locale/az_AZ/LC_MESSAGES/django.po +1 -1
  668. wagtail/contrib/settings/locale/be/LC_MESSAGES/django.po +1 -1
  669. wagtail/contrib/settings/locale/bn/LC_MESSAGES/django.po +1 -1
  670. wagtail/contrib/settings/locale/ca/LC_MESSAGES/django.po +1 -1
  671. wagtail/contrib/settings/locale/cs/LC_MESSAGES/django.po +1 -1
  672. wagtail/contrib/settings/locale/cy/LC_MESSAGES/django.po +1 -1
  673. wagtail/contrib/settings/locale/da/LC_MESSAGES/django.po +1 -1
  674. wagtail/contrib/settings/locale/de/LC_MESSAGES/django.po +1 -1
  675. wagtail/contrib/settings/locale/dv/LC_MESSAGES/django.po +1 -1
  676. wagtail/contrib/settings/locale/el/LC_MESSAGES/django.po +1 -1
  677. wagtail/contrib/settings/locale/en/LC_MESSAGES/django.po +1 -1
  678. wagtail/contrib/settings/locale/en_IN/LC_MESSAGES/django.po +1 -1
  679. wagtail/contrib/settings/locale/es/LC_MESSAGES/django.po +1 -1
  680. wagtail/contrib/settings/locale/es_419/LC_MESSAGES/django.po +1 -1
  681. wagtail/contrib/settings/locale/es_VE/LC_MESSAGES/django.po +1 -1
  682. wagtail/contrib/settings/locale/et/LC_MESSAGES/django.po +1 -1
  683. wagtail/contrib/settings/locale/fa/LC_MESSAGES/django.po +1 -1
  684. wagtail/contrib/settings/locale/fi/LC_MESSAGES/django.po +1 -1
  685. wagtail/contrib/settings/locale/fr/LC_MESSAGES/django.po +1 -1
  686. wagtail/contrib/settings/locale/gl/LC_MESSAGES/django.po +1 -1
  687. wagtail/contrib/settings/locale/he_IL/LC_MESSAGES/django.po +1 -1
  688. wagtail/contrib/settings/locale/hi/LC_MESSAGES/django.po +1 -1
  689. wagtail/contrib/settings/locale/hr_HR/LC_MESSAGES/django.po +1 -1
  690. wagtail/contrib/settings/locale/ht/LC_MESSAGES/django.po +1 -1
  691. wagtail/contrib/settings/locale/hu/LC_MESSAGES/django.po +1 -1
  692. wagtail/contrib/settings/locale/id_ID/LC_MESSAGES/django.po +1 -1
  693. wagtail/contrib/settings/locale/is_IS/LC_MESSAGES/django.po +1 -1
  694. wagtail/contrib/settings/locale/it/LC_MESSAGES/django.po +1 -1
  695. wagtail/contrib/settings/locale/ja/LC_MESSAGES/django.po +1 -1
  696. wagtail/contrib/settings/locale/ka/LC_MESSAGES/django.po +1 -1
  697. wagtail/contrib/settings/locale/ko/LC_MESSAGES/django.po +1 -1
  698. wagtail/contrib/settings/locale/lt/LC_MESSAGES/django.po +1 -1
  699. wagtail/contrib/settings/locale/lv/LC_MESSAGES/django.po +1 -1
  700. wagtail/contrib/settings/locale/mi/LC_MESSAGES/django.po +1 -1
  701. wagtail/contrib/settings/locale/mn/LC_MESSAGES/django.po +1 -1
  702. wagtail/contrib/settings/locale/my/LC_MESSAGES/django.po +1 -1
  703. wagtail/contrib/settings/locale/nb/LC_MESSAGES/django.po +1 -1
  704. wagtail/contrib/settings/locale/nl/LC_MESSAGES/django.po +1 -1
  705. wagtail/contrib/settings/locale/pl/LC_MESSAGES/django.po +1 -1
  706. wagtail/contrib/settings/locale/pt_BR/LC_MESSAGES/django.po +1 -1
  707. wagtail/contrib/settings/locale/pt_PT/LC_MESSAGES/django.po +1 -1
  708. wagtail/contrib/settings/locale/ro/LC_MESSAGES/django.po +1 -1
  709. wagtail/contrib/settings/locale/ru/LC_MESSAGES/django.po +1 -1
  710. wagtail/contrib/settings/locale/sk_SK/LC_MESSAGES/django.po +1 -1
  711. wagtail/contrib/settings/locale/sl/LC_MESSAGES/django.po +1 -1
  712. wagtail/contrib/settings/locale/sr/LC_MESSAGES/django.po +1 -1
  713. wagtail/contrib/settings/locale/sv/LC_MESSAGES/django.po +1 -1
  714. wagtail/contrib/settings/locale/ta/LC_MESSAGES/django.po +1 -1
  715. wagtail/contrib/settings/locale/tet/LC_MESSAGES/django.po +1 -1
  716. wagtail/contrib/settings/locale/th/LC_MESSAGES/django.po +1 -1
  717. wagtail/contrib/settings/locale/tr/LC_MESSAGES/django.po +1 -1
  718. wagtail/contrib/settings/locale/tr_TR/LC_MESSAGES/django.po +1 -1
  719. wagtail/contrib/settings/locale/ug/LC_MESSAGES/django.po +1 -1
  720. wagtail/contrib/settings/locale/uk/LC_MESSAGES/django.po +1 -1
  721. wagtail/contrib/settings/locale/vi/LC_MESSAGES/django.po +1 -1
  722. wagtail/contrib/settings/locale/zh/LC_MESSAGES/django.po +1 -1
  723. wagtail/contrib/settings/locale/zh_Hans/LC_MESSAGES/django.po +1 -1
  724. wagtail/contrib/settings/locale/zh_Hant/LC_MESSAGES/django.po +1 -1
  725. wagtail/contrib/settings/registry.py +1 -11
  726. wagtail/contrib/simple_translation/locale/ar/LC_MESSAGES/django.po +1 -1
  727. wagtail/contrib/simple_translation/locale/be/LC_MESSAGES/django.po +1 -1
  728. wagtail/contrib/simple_translation/locale/ca/LC_MESSAGES/django.po +1 -1
  729. wagtail/contrib/simple_translation/locale/cs/LC_MESSAGES/django.po +1 -1
  730. wagtail/contrib/simple_translation/locale/cy/LC_MESSAGES/django.po +1 -1
  731. wagtail/contrib/simple_translation/locale/de/LC_MESSAGES/django.po +1 -1
  732. wagtail/contrib/simple_translation/locale/dv/LC_MESSAGES/django.po +1 -1
  733. wagtail/contrib/simple_translation/locale/el/LC_MESSAGES/django.po +1 -1
  734. wagtail/contrib/simple_translation/locale/en/LC_MESSAGES/django.po +1 -1
  735. wagtail/contrib/simple_translation/locale/es/LC_MESSAGES/django.po +1 -1
  736. wagtail/contrib/simple_translation/locale/es_419/LC_MESSAGES/django.po +1 -1
  737. wagtail/contrib/simple_translation/locale/fa/LC_MESSAGES/django.po +1 -1
  738. wagtail/contrib/simple_translation/locale/fi/LC_MESSAGES/django.po +1 -1
  739. wagtail/contrib/simple_translation/locale/fr/LC_MESSAGES/django.po +1 -1
  740. wagtail/contrib/simple_translation/locale/gl/LC_MESSAGES/django.po +1 -1
  741. wagtail/contrib/simple_translation/locale/hr_HR/LC_MESSAGES/django.po +3 -3
  742. wagtail/contrib/simple_translation/locale/hu/LC_MESSAGES/django.mo +0 -0
  743. wagtail/contrib/simple_translation/locale/hu/LC_MESSAGES/django.po +6 -3
  744. wagtail/contrib/simple_translation/locale/is_IS/LC_MESSAGES/django.po +3 -3
  745. wagtail/contrib/simple_translation/locale/it/LC_MESSAGES/django.po +1 -1
  746. wagtail/contrib/simple_translation/locale/ko/LC_MESSAGES/django.po +1 -1
  747. wagtail/contrib/simple_translation/locale/lt/LC_MESSAGES/django.po +1 -1
  748. wagtail/contrib/simple_translation/locale/mi/LC_MESSAGES/django.po +1 -1
  749. wagtail/contrib/simple_translation/locale/mn/LC_MESSAGES/django.po +1 -1
  750. wagtail/contrib/simple_translation/locale/nb/LC_MESSAGES/django.po +3 -3
  751. wagtail/contrib/simple_translation/locale/nl/LC_MESSAGES/django.po +1 -1
  752. wagtail/contrib/simple_translation/locale/pl/LC_MESSAGES/django.po +1 -1
  753. wagtail/contrib/simple_translation/locale/pt_BR/LC_MESSAGES/django.po +3 -3
  754. wagtail/contrib/simple_translation/locale/pt_PT/LC_MESSAGES/django.po +1 -1
  755. wagtail/contrib/simple_translation/locale/ro/LC_MESSAGES/django.po +1 -1
  756. wagtail/contrib/simple_translation/locale/ru/LC_MESSAGES/django.po +1 -1
  757. wagtail/contrib/simple_translation/locale/sl/LC_MESSAGES/django.po +1 -1
  758. wagtail/contrib/simple_translation/locale/sv/LC_MESSAGES/django.po +1 -1
  759. wagtail/contrib/simple_translation/locale/ug/LC_MESSAGES/django.po +1 -1
  760. wagtail/contrib/simple_translation/locale/uk/LC_MESSAGES/django.po +1 -1
  761. wagtail/contrib/simple_translation/locale/vi/LC_MESSAGES/django.po +1 -1
  762. wagtail/contrib/simple_translation/locale/zh_Hans/LC_MESSAGES/django.po +3 -3
  763. wagtail/contrib/simple_translation/locale/zh_Hant/LC_MESSAGES/django.po +3 -3
  764. wagtail/contrib/styleguide/locale/af/LC_MESSAGES/django.po +1 -1
  765. wagtail/contrib/styleguide/locale/ar/LC_MESSAGES/django.po +1 -1
  766. wagtail/contrib/styleguide/locale/az_AZ/LC_MESSAGES/django.po +1 -1
  767. wagtail/contrib/styleguide/locale/be/LC_MESSAGES/django.mo +0 -0
  768. wagtail/contrib/styleguide/locale/be/LC_MESSAGES/django.po +3 -2
  769. wagtail/contrib/styleguide/locale/bg/LC_MESSAGES/django.po +1 -1
  770. wagtail/contrib/styleguide/locale/bn/LC_MESSAGES/django.po +1 -1
  771. wagtail/contrib/styleguide/locale/ca/LC_MESSAGES/django.po +1 -1
  772. wagtail/contrib/styleguide/locale/cs/LC_MESSAGES/django.po +1 -1
  773. wagtail/contrib/styleguide/locale/cy/LC_MESSAGES/django.po +2 -1
  774. wagtail/contrib/styleguide/locale/da/LC_MESSAGES/django.po +1 -1
  775. wagtail/contrib/styleguide/locale/de/LC_MESSAGES/django.po +1 -1
  776. wagtail/contrib/styleguide/locale/dv/LC_MESSAGES/django.po +2 -1
  777. wagtail/contrib/styleguide/locale/el/LC_MESSAGES/django.po +2 -1
  778. wagtail/contrib/styleguide/locale/en/LC_MESSAGES/django.po +7 -7
  779. wagtail/contrib/styleguide/locale/en_IN/LC_MESSAGES/django.po +1 -1
  780. wagtail/contrib/styleguide/locale/es/LC_MESSAGES/django.po +1 -1
  781. wagtail/contrib/styleguide/locale/es_419/LC_MESSAGES/django.po +1 -1
  782. wagtail/contrib/styleguide/locale/es_VE/LC_MESSAGES/django.po +1 -1
  783. wagtail/contrib/styleguide/locale/et/LC_MESSAGES/django.po +1 -1
  784. wagtail/contrib/styleguide/locale/fa/LC_MESSAGES/django.po +1 -1
  785. wagtail/contrib/styleguide/locale/fi/LC_MESSAGES/django.po +1 -1
  786. wagtail/contrib/styleguide/locale/fr/LC_MESSAGES/django.po +1 -1
  787. wagtail/contrib/styleguide/locale/gl/LC_MESSAGES/django.po +1 -1
  788. wagtail/contrib/styleguide/locale/he_IL/LC_MESSAGES/django.po +1 -1
  789. wagtail/contrib/styleguide/locale/hi/LC_MESSAGES/django.po +1 -1
  790. wagtail/contrib/styleguide/locale/hr_HR/LC_MESSAGES/django.po +1 -1
  791. wagtail/contrib/styleguide/locale/ht/LC_MESSAGES/django.po +1 -1
  792. wagtail/contrib/styleguide/locale/hu/LC_MESSAGES/django.po +1 -1
  793. wagtail/contrib/styleguide/locale/id_ID/LC_MESSAGES/django.po +1 -1
  794. wagtail/contrib/styleguide/locale/is_IS/LC_MESSAGES/django.po +1 -1
  795. wagtail/contrib/styleguide/locale/it/LC_MESSAGES/django.po +1 -1
  796. wagtail/contrib/styleguide/locale/ja/LC_MESSAGES/django.po +1 -1
  797. wagtail/contrib/styleguide/locale/ka/LC_MESSAGES/django.po +1 -1
  798. wagtail/contrib/styleguide/locale/ko/LC_MESSAGES/django.po +1 -1
  799. wagtail/contrib/styleguide/locale/lt/LC_MESSAGES/django.po +1 -1
  800. wagtail/contrib/styleguide/locale/lv/LC_MESSAGES/django.po +1 -1
  801. wagtail/contrib/styleguide/locale/mi/LC_MESSAGES/django.po +1 -1
  802. wagtail/contrib/styleguide/locale/mn/LC_MESSAGES/django.po +1 -1
  803. wagtail/contrib/styleguide/locale/my/LC_MESSAGES/django.po +1 -1
  804. wagtail/contrib/styleguide/locale/nb/LC_MESSAGES/django.po +1 -1
  805. wagtail/contrib/styleguide/locale/nl/LC_MESSAGES/django.po +1 -1
  806. wagtail/contrib/styleguide/locale/pl/LC_MESSAGES/django.po +1 -1
  807. wagtail/contrib/styleguide/locale/pt_BR/LC_MESSAGES/django.po +1 -1
  808. wagtail/contrib/styleguide/locale/pt_PT/LC_MESSAGES/django.po +1 -1
  809. wagtail/contrib/styleguide/locale/ro/LC_MESSAGES/django.po +1 -1
  810. wagtail/contrib/styleguide/locale/ru/LC_MESSAGES/django.po +1 -1
  811. wagtail/contrib/styleguide/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
  812. wagtail/contrib/styleguide/locale/sk_SK/LC_MESSAGES/django.po +2 -2
  813. wagtail/contrib/styleguide/locale/sl/LC_MESSAGES/django.po +1 -1
  814. wagtail/contrib/styleguide/locale/sv/LC_MESSAGES/django.po +1 -1
  815. wagtail/contrib/styleguide/locale/ta/LC_MESSAGES/django.po +1 -1
  816. wagtail/contrib/styleguide/locale/tet/LC_MESSAGES/django.po +1 -1
  817. wagtail/contrib/styleguide/locale/th/LC_MESSAGES/django.po +1 -1
  818. wagtail/contrib/styleguide/locale/tr/LC_MESSAGES/django.po +1 -1
  819. wagtail/contrib/styleguide/locale/tr_TR/LC_MESSAGES/django.po +1 -1
  820. wagtail/contrib/styleguide/locale/ug/LC_MESSAGES/django.po +1 -1
  821. wagtail/contrib/styleguide/locale/uk/LC_MESSAGES/django.po +1 -1
  822. wagtail/contrib/styleguide/locale/vi/LC_MESSAGES/django.po +1 -1
  823. wagtail/contrib/styleguide/locale/zh/LC_MESSAGES/django.po +1 -1
  824. wagtail/contrib/styleguide/locale/zh_Hans/LC_MESSAGES/django.po +1 -1
  825. wagtail/contrib/styleguide/locale/zh_Hant/LC_MESSAGES/django.po +1 -1
  826. wagtail/contrib/styleguide/views.py +2 -1
  827. wagtail/contrib/table_block/locale/ar/LC_MESSAGES/django.po +1 -1
  828. wagtail/contrib/table_block/locale/be/LC_MESSAGES/django.po +1 -1
  829. wagtail/contrib/table_block/locale/ca/LC_MESSAGES/django.po +1 -1
  830. wagtail/contrib/table_block/locale/cs/LC_MESSAGES/django.po +1 -1
  831. wagtail/contrib/table_block/locale/cy/LC_MESSAGES/django.po +1 -1
  832. wagtail/contrib/table_block/locale/de/LC_MESSAGES/django.po +1 -1
  833. wagtail/contrib/table_block/locale/dv/LC_MESSAGES/django.po +1 -1
  834. wagtail/contrib/table_block/locale/el/LC_MESSAGES/django.po +1 -1
  835. wagtail/contrib/table_block/locale/en/LC_MESSAGES/django.po +1 -1
  836. wagtail/contrib/table_block/locale/en_IN/LC_MESSAGES/django.po +1 -1
  837. wagtail/contrib/table_block/locale/es/LC_MESSAGES/django.po +1 -1
  838. wagtail/contrib/table_block/locale/et/LC_MESSAGES/django.po +1 -1
  839. wagtail/contrib/table_block/locale/fa/LC_MESSAGES/django.po +1 -1
  840. wagtail/contrib/table_block/locale/fi/LC_MESSAGES/django.po +1 -1
  841. wagtail/contrib/table_block/locale/fr/LC_MESSAGES/django.po +1 -1
  842. wagtail/contrib/table_block/locale/gl/LC_MESSAGES/django.po +1 -1
  843. wagtail/contrib/table_block/locale/hr_HR/LC_MESSAGES/django.po +1 -1
  844. wagtail/contrib/table_block/locale/ht/LC_MESSAGES/django.po +1 -1
  845. wagtail/contrib/table_block/locale/hu/LC_MESSAGES/django.po +1 -1
  846. wagtail/contrib/table_block/locale/id_ID/LC_MESSAGES/django.po +1 -1
  847. wagtail/contrib/table_block/locale/is_IS/LC_MESSAGES/django.po +1 -1
  848. wagtail/contrib/table_block/locale/it/LC_MESSAGES/django.po +1 -1
  849. wagtail/contrib/table_block/locale/ja/LC_MESSAGES/django.po +1 -1
  850. wagtail/contrib/table_block/locale/ko/LC_MESSAGES/django.po +1 -1
  851. wagtail/contrib/table_block/locale/lt/LC_MESSAGES/django.po +1 -1
  852. wagtail/contrib/table_block/locale/lv/LC_MESSAGES/django.po +1 -1
  853. wagtail/contrib/table_block/locale/mi/LC_MESSAGES/django.po +1 -1
  854. wagtail/contrib/table_block/locale/mn/LC_MESSAGES/django.po +1 -1
  855. wagtail/contrib/table_block/locale/my/LC_MESSAGES/django.po +1 -1
  856. wagtail/contrib/table_block/locale/nb/LC_MESSAGES/django.po +1 -1
  857. wagtail/contrib/table_block/locale/nl/LC_MESSAGES/django.po +1 -1
  858. wagtail/contrib/table_block/locale/pl/LC_MESSAGES/django.po +1 -1
  859. wagtail/contrib/table_block/locale/pt_BR/LC_MESSAGES/django.po +1 -1
  860. wagtail/contrib/table_block/locale/pt_PT/LC_MESSAGES/django.po +1 -1
  861. wagtail/contrib/table_block/locale/ro/LC_MESSAGES/django.po +1 -1
  862. wagtail/contrib/table_block/locale/ru/LC_MESSAGES/django.po +1 -1
  863. wagtail/contrib/table_block/locale/sk_SK/LC_MESSAGES/django.po +1 -1
  864. wagtail/contrib/table_block/locale/sl/LC_MESSAGES/django.po +1 -1
  865. wagtail/contrib/table_block/locale/sv/LC_MESSAGES/django.po +1 -1
  866. wagtail/contrib/table_block/locale/tet/LC_MESSAGES/django.po +1 -1
  867. wagtail/contrib/table_block/locale/th/LC_MESSAGES/django.po +1 -1
  868. wagtail/contrib/table_block/locale/tr/LC_MESSAGES/django.po +1 -1
  869. wagtail/contrib/table_block/locale/tr_TR/LC_MESSAGES/django.po +1 -1
  870. wagtail/contrib/table_block/locale/ug/LC_MESSAGES/django.po +1 -1
  871. wagtail/contrib/table_block/locale/uk/LC_MESSAGES/django.po +1 -1
  872. wagtail/contrib/table_block/locale/vi/LC_MESSAGES/django.po +1 -1
  873. wagtail/contrib/table_block/locale/zh_Hans/LC_MESSAGES/django.po +1 -1
  874. wagtail/contrib/table_block/locale/zh_Hant/LC_MESSAGES/django.po +1 -1
  875. wagtail/contrib/typed_table_block/blocks.py +5 -0
  876. wagtail/contrib/typed_table_block/locale/ar/LC_MESSAGES/django.po +1 -1
  877. wagtail/contrib/typed_table_block/locale/be/LC_MESSAGES/django.po +1 -1
  878. wagtail/contrib/typed_table_block/locale/ca/LC_MESSAGES/django.po +1 -1
  879. wagtail/contrib/typed_table_block/locale/cy/LC_MESSAGES/django.po +1 -1
  880. wagtail/contrib/typed_table_block/locale/de/LC_MESSAGES/django.po +1 -1
  881. wagtail/contrib/typed_table_block/locale/dv/LC_MESSAGES/django.po +1 -1
  882. wagtail/contrib/typed_table_block/locale/el/LC_MESSAGES/django.po +1 -1
  883. wagtail/contrib/typed_table_block/locale/en/LC_MESSAGES/django.po +10 -10
  884. wagtail/contrib/typed_table_block/locale/es/LC_MESSAGES/django.po +1 -1
  885. wagtail/contrib/typed_table_block/locale/fa/LC_MESSAGES/django.po +1 -1
  886. wagtail/contrib/typed_table_block/locale/fi/LC_MESSAGES/django.po +1 -1
  887. wagtail/contrib/typed_table_block/locale/fr/LC_MESSAGES/django.po +1 -1
  888. wagtail/contrib/typed_table_block/locale/gl/LC_MESSAGES/django.po +1 -1
  889. wagtail/contrib/typed_table_block/locale/hu/LC_MESSAGES/django.po +1 -1
  890. wagtail/contrib/typed_table_block/locale/is_IS/LC_MESSAGES/django.po +3 -3
  891. wagtail/contrib/typed_table_block/locale/it/LC_MESSAGES/django.po +1 -1
  892. wagtail/contrib/typed_table_block/locale/ko/LC_MESSAGES/django.po +1 -1
  893. wagtail/contrib/typed_table_block/locale/lt/LC_MESSAGES/django.po +1 -1
  894. wagtail/contrib/typed_table_block/locale/nl/LC_MESSAGES/django.po +1 -1
  895. wagtail/contrib/typed_table_block/locale/pl/LC_MESSAGES/django.po +1 -1
  896. wagtail/contrib/typed_table_block/locale/pt_BR/LC_MESSAGES/django.po +3 -3
  897. wagtail/contrib/typed_table_block/locale/pt_PT/LC_MESSAGES/django.po +1 -1
  898. wagtail/contrib/typed_table_block/locale/ro/LC_MESSAGES/django.po +1 -1
  899. wagtail/contrib/typed_table_block/locale/ru/LC_MESSAGES/django.po +1 -1
  900. wagtail/contrib/typed_table_block/locale/sl/LC_MESSAGES/django.po +1 -1
  901. wagtail/contrib/typed_table_block/locale/sv/LC_MESSAGES/django.po +1 -1
  902. wagtail/contrib/typed_table_block/locale/th/LC_MESSAGES/django.po +1 -1
  903. wagtail/contrib/typed_table_block/locale/ug/LC_MESSAGES/django.po +1 -1
  904. wagtail/contrib/typed_table_block/locale/uk/LC_MESSAGES/django.po +1 -1
  905. wagtail/contrib/typed_table_block/locale/zh/LC_MESSAGES/django.po +1 -1
  906. wagtail/contrib/typed_table_block/locale/zh_Hans/LC_MESSAGES/django.po +3 -3
  907. wagtail/contrib/typed_table_block/locale/zh_Hant/LC_MESSAGES/django.po +3 -3
  908. wagtail/contrib/typed_table_block/tests.py +27 -0
  909. wagtail/coreutils.py +0 -19
  910. wagtail/documents/locale/af/LC_MESSAGES/django.po +1 -1
  911. wagtail/documents/locale/ar/LC_MESSAGES/django.mo +0 -0
  912. wagtail/documents/locale/ar/LC_MESSAGES/django.po +3 -2
  913. wagtail/documents/locale/az_AZ/LC_MESSAGES/django.po +1 -1
  914. wagtail/documents/locale/be/LC_MESSAGES/django.po +1 -1
  915. wagtail/documents/locale/bg/LC_MESSAGES/django.po +1 -1
  916. wagtail/documents/locale/bn/LC_MESSAGES/django.po +1 -1
  917. wagtail/documents/locale/ca/LC_MESSAGES/django.mo +0 -0
  918. wagtail/documents/locale/ca/LC_MESSAGES/django.po +2 -2
  919. wagtail/documents/locale/cs/LC_MESSAGES/django.po +1 -1
  920. wagtail/documents/locale/cy/LC_MESSAGES/django.po +1 -1
  921. wagtail/documents/locale/da/LC_MESSAGES/django.po +1 -1
  922. wagtail/documents/locale/de/LC_MESSAGES/django.mo +0 -0
  923. wagtail/documents/locale/de/LC_MESSAGES/django.po +3 -3
  924. wagtail/documents/locale/dv/LC_MESSAGES/django.po +2 -1
  925. wagtail/documents/locale/el/LC_MESSAGES/django.po +2 -1
  926. wagtail/documents/locale/en/LC_MESSAGES/django.po +4 -4
  927. wagtail/documents/locale/es/LC_MESSAGES/django.mo +0 -0
  928. wagtail/documents/locale/es/LC_MESSAGES/django.po +3 -2
  929. wagtail/documents/locale/es_419/LC_MESSAGES/django.po +1 -1
  930. wagtail/documents/locale/et/LC_MESSAGES/django.po +1 -1
  931. wagtail/documents/locale/eu/LC_MESSAGES/django.po +1 -1
  932. wagtail/documents/locale/fa/LC_MESSAGES/django.po +1 -1
  933. wagtail/documents/locale/fi/LC_MESSAGES/django.mo +0 -0
  934. wagtail/documents/locale/fi/LC_MESSAGES/django.po +2 -2
  935. wagtail/documents/locale/fr/LC_MESSAGES/django.po +2 -1
  936. wagtail/documents/locale/gl/LC_MESSAGES/django.po +1 -1
  937. wagtail/documents/locale/he_IL/LC_MESSAGES/django.po +1 -1
  938. wagtail/documents/locale/hr_HR/LC_MESSAGES/django.po +1 -1
  939. wagtail/documents/locale/ht/LC_MESSAGES/django.po +1 -1
  940. wagtail/documents/locale/hu/LC_MESSAGES/django.mo +0 -0
  941. wagtail/documents/locale/hu/LC_MESSAGES/django.po +18 -3
  942. wagtail/documents/locale/id_ID/LC_MESSAGES/django.po +1 -1
  943. wagtail/documents/locale/is_IS/LC_MESSAGES/django.po +1 -1
  944. wagtail/documents/locale/it/LC_MESSAGES/django.mo +0 -0
  945. wagtail/documents/locale/it/LC_MESSAGES/django.po +2 -2
  946. wagtail/documents/locale/ja/LC_MESSAGES/django.po +1 -1
  947. wagtail/documents/locale/ka/LC_MESSAGES/django.po +1 -1
  948. wagtail/documents/locale/ko/LC_MESSAGES/django.mo +0 -0
  949. wagtail/documents/locale/ko/LC_MESSAGES/django.po +14 -2
  950. wagtail/documents/locale/lt/LC_MESSAGES/django.po +1 -1
  951. wagtail/documents/locale/lv/LC_MESSAGES/django.po +1 -1
  952. wagtail/documents/locale/mi/LC_MESSAGES/django.po +1 -1
  953. wagtail/documents/locale/mn/LC_MESSAGES/django.po +1 -1
  954. wagtail/documents/locale/my/LC_MESSAGES/django.po +1 -1
  955. wagtail/documents/locale/nb/LC_MESSAGES/django.mo +0 -0
  956. wagtail/documents/locale/nb/LC_MESSAGES/django.po +3 -2
  957. wagtail/documents/locale/nl/LC_MESSAGES/django.mo +0 -0
  958. wagtail/documents/locale/nl/LC_MESSAGES/django.po +2 -2
  959. wagtail/documents/locale/pl/LC_MESSAGES/django.mo +0 -0
  960. wagtail/documents/locale/pl/LC_MESSAGES/django.po +2 -2
  961. wagtail/documents/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
  962. wagtail/documents/locale/pt_BR/LC_MESSAGES/django.po +2 -2
  963. wagtail/documents/locale/pt_PT/LC_MESSAGES/django.po +1 -1
  964. wagtail/documents/locale/ro/LC_MESSAGES/django.mo +0 -0
  965. wagtail/documents/locale/ro/LC_MESSAGES/django.po +2 -2
  966. wagtail/documents/locale/ru/LC_MESSAGES/django.mo +0 -0
  967. wagtail/documents/locale/ru/LC_MESSAGES/django.po +5 -2
  968. wagtail/documents/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
  969. wagtail/documents/locale/sk_SK/LC_MESSAGES/django.po +2 -2
  970. wagtail/documents/locale/sl/LC_MESSAGES/django.mo +0 -0
  971. wagtail/documents/locale/sl/LC_MESSAGES/django.po +2 -2
  972. wagtail/documents/locale/sv/LC_MESSAGES/django.po +1 -1
  973. wagtail/documents/locale/tet/LC_MESSAGES/django.po +1 -1
  974. wagtail/documents/locale/th/LC_MESSAGES/django.po +1 -1
  975. wagtail/documents/locale/tr/LC_MESSAGES/django.po +1 -1
  976. wagtail/documents/locale/tr_TR/LC_MESSAGES/django.po +1 -1
  977. wagtail/documents/locale/ug/LC_MESSAGES/django.po +1 -1
  978. wagtail/documents/locale/uk/LC_MESSAGES/django.po +1 -1
  979. wagtail/documents/locale/vi/LC_MESSAGES/django.po +1 -1
  980. wagtail/documents/locale/zh/LC_MESSAGES/django.po +1 -1
  981. wagtail/documents/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  982. wagtail/documents/locale/zh_Hans/LC_MESSAGES/django.po +3 -2
  983. wagtail/documents/locale/zh_Hant/LC_MESSAGES/django.po +1 -1
  984. wagtail/documents/rich_text/contentstate.py +1 -0
  985. wagtail/documents/rich_text/editor_html.py +1 -0
  986. wagtail/documents/tests/test_collection_privacy.py +1 -1
  987. wagtail/documents/tests/test_serializers.py +0 -1
  988. wagtail/documents/views/serve.py +0 -15
  989. wagtail/documents/wagtail_hooks.py +2 -17
  990. wagtail/embeds/locale/ar/LC_MESSAGES/django.po +1 -1
  991. wagtail/embeds/locale/az_AZ/LC_MESSAGES/django.po +1 -1
  992. wagtail/embeds/locale/be/LC_MESSAGES/django.po +1 -1
  993. wagtail/embeds/locale/bg/LC_MESSAGES/django.po +1 -1
  994. wagtail/embeds/locale/bn/LC_MESSAGES/django.po +1 -1
  995. wagtail/embeds/locale/ca/LC_MESSAGES/django.po +1 -1
  996. wagtail/embeds/locale/cs/LC_MESSAGES/django.po +1 -1
  997. wagtail/embeds/locale/cy/LC_MESSAGES/django.po +1 -1
  998. wagtail/embeds/locale/da/LC_MESSAGES/django.po +1 -1
  999. wagtail/embeds/locale/de/LC_MESSAGES/django.po +1 -1
  1000. wagtail/embeds/locale/dv/LC_MESSAGES/django.po +1 -1
  1001. wagtail/embeds/locale/el/LC_MESSAGES/django.po +1 -1
  1002. wagtail/embeds/locale/en/LC_MESSAGES/django.po +1 -1
  1003. wagtail/embeds/locale/es/LC_MESSAGES/django.po +1 -1
  1004. wagtail/embeds/locale/es_419/LC_MESSAGES/django.po +1 -1
  1005. wagtail/embeds/locale/et/LC_MESSAGES/django.po +1 -1
  1006. wagtail/embeds/locale/fa/LC_MESSAGES/django.po +1 -1
  1007. wagtail/embeds/locale/fi/LC_MESSAGES/django.po +1 -1
  1008. wagtail/embeds/locale/fr/LC_MESSAGES/django.po +1 -1
  1009. wagtail/embeds/locale/gl/LC_MESSAGES/django.po +1 -1
  1010. wagtail/embeds/locale/he_IL/LC_MESSAGES/django.po +1 -1
  1011. wagtail/embeds/locale/hr_HR/LC_MESSAGES/django.po +1 -1
  1012. wagtail/embeds/locale/ht/LC_MESSAGES/django.po +1 -1
  1013. wagtail/embeds/locale/hu/LC_MESSAGES/django.po +1 -1
  1014. wagtail/embeds/locale/id_ID/LC_MESSAGES/django.po +1 -1
  1015. wagtail/embeds/locale/is_IS/LC_MESSAGES/django.po +1 -1
  1016. wagtail/embeds/locale/it/LC_MESSAGES/django.po +1 -1
  1017. wagtail/embeds/locale/ja/LC_MESSAGES/django.po +1 -1
  1018. wagtail/embeds/locale/ko/LC_MESSAGES/django.po +1 -1
  1019. wagtail/embeds/locale/lt/LC_MESSAGES/django.po +1 -1
  1020. wagtail/embeds/locale/lv/LC_MESSAGES/django.po +1 -1
  1021. wagtail/embeds/locale/mi/LC_MESSAGES/django.po +1 -1
  1022. wagtail/embeds/locale/mn/LC_MESSAGES/django.po +1 -1
  1023. wagtail/embeds/locale/my/LC_MESSAGES/django.po +1 -1
  1024. wagtail/embeds/locale/nb/LC_MESSAGES/django.po +1 -1
  1025. wagtail/embeds/locale/nl/LC_MESSAGES/django.po +1 -1
  1026. wagtail/embeds/locale/pl/LC_MESSAGES/django.po +1 -1
  1027. wagtail/embeds/locale/pt_BR/LC_MESSAGES/django.po +1 -1
  1028. wagtail/embeds/locale/pt_PT/LC_MESSAGES/django.po +1 -1
  1029. wagtail/embeds/locale/ro/LC_MESSAGES/django.po +1 -1
  1030. wagtail/embeds/locale/ru/LC_MESSAGES/django.po +1 -1
  1031. wagtail/embeds/locale/sk_SK/LC_MESSAGES/django.po +1 -1
  1032. wagtail/embeds/locale/sl/LC_MESSAGES/django.po +1 -1
  1033. wagtail/embeds/locale/sv/LC_MESSAGES/django.po +1 -1
  1034. wagtail/embeds/locale/tet/LC_MESSAGES/django.po +1 -1
  1035. wagtail/embeds/locale/th/LC_MESSAGES/django.po +1 -1
  1036. wagtail/embeds/locale/tr/LC_MESSAGES/django.po +1 -1
  1037. wagtail/embeds/locale/tr_TR/LC_MESSAGES/django.po +1 -1
  1038. wagtail/embeds/locale/ug/LC_MESSAGES/django.po +1 -1
  1039. wagtail/embeds/locale/uk/LC_MESSAGES/django.po +1 -1
  1040. wagtail/embeds/locale/vi/LC_MESSAGES/django.po +1 -1
  1041. wagtail/embeds/locale/zh/LC_MESSAGES/django.po +1 -1
  1042. wagtail/embeds/locale/zh_Hans/LC_MESSAGES/django.po +1 -1
  1043. wagtail/embeds/locale/zh_Hant/LC_MESSAGES/django.po +1 -1
  1044. wagtail/embeds/rich_text/contentstate.py +1 -0
  1045. wagtail/embeds/rich_text/editor_html.py +1 -0
  1046. wagtail/embeds/wagtail_hooks.py +1 -1
  1047. wagtail/images/formats.py +0 -11
  1048. wagtail/images/locale/ar/LC_MESSAGES/django.po +1 -1
  1049. wagtail/images/locale/az_AZ/LC_MESSAGES/django.po +1 -1
  1050. wagtail/images/locale/be/LC_MESSAGES/django.po +1 -1
  1051. wagtail/images/locale/bg/LC_MESSAGES/django.po +1 -1
  1052. wagtail/images/locale/bn/LC_MESSAGES/django.po +1 -1
  1053. wagtail/images/locale/ca/LC_MESSAGES/django.mo +0 -0
  1054. wagtail/images/locale/ca/LC_MESSAGES/django.po +2 -2
  1055. wagtail/images/locale/cs/LC_MESSAGES/django.mo +0 -0
  1056. wagtail/images/locale/cs/LC_MESSAGES/django.po +3 -2
  1057. wagtail/images/locale/cy/LC_MESSAGES/django.po +2 -1
  1058. wagtail/images/locale/da/LC_MESSAGES/django.po +1 -1
  1059. wagtail/images/locale/de/LC_MESSAGES/django.mo +0 -0
  1060. wagtail/images/locale/de/LC_MESSAGES/django.po +3 -2
  1061. wagtail/images/locale/dv/LC_MESSAGES/django.po +2 -1
  1062. wagtail/images/locale/el/LC_MESSAGES/django.po +1 -1
  1063. wagtail/images/locale/en/LC_MESSAGES/django.po +4 -4
  1064. wagtail/images/locale/es/LC_MESSAGES/django.po +1 -1
  1065. wagtail/images/locale/es_419/LC_MESSAGES/django.po +1 -1
  1066. wagtail/images/locale/et/LC_MESSAGES/django.po +1 -1
  1067. wagtail/images/locale/eu/LC_MESSAGES/django.po +1 -1
  1068. wagtail/images/locale/fa/LC_MESSAGES/django.mo +0 -0
  1069. wagtail/images/locale/fa/LC_MESSAGES/django.po +3 -2
  1070. wagtail/images/locale/fi/LC_MESSAGES/django.mo +0 -0
  1071. wagtail/images/locale/fi/LC_MESSAGES/django.po +2 -2
  1072. wagtail/images/locale/fr/LC_MESSAGES/django.mo +0 -0
  1073. wagtail/images/locale/fr/LC_MESSAGES/django.po +3 -2
  1074. wagtail/images/locale/gl/LC_MESSAGES/django.mo +0 -0
  1075. wagtail/images/locale/gl/LC_MESSAGES/django.po +2 -2
  1076. wagtail/images/locale/he_IL/LC_MESSAGES/django.po +1 -1
  1077. wagtail/images/locale/hr_HR/LC_MESSAGES/django.po +1 -1
  1078. wagtail/images/locale/ht/LC_MESSAGES/django.po +1 -1
  1079. wagtail/images/locale/hu/LC_MESSAGES/django.mo +0 -0
  1080. wagtail/images/locale/hu/LC_MESSAGES/django.po +23 -3
  1081. wagtail/images/locale/id_ID/LC_MESSAGES/django.po +1 -1
  1082. wagtail/images/locale/is_IS/LC_MESSAGES/django.po +1 -1
  1083. wagtail/images/locale/it/LC_MESSAGES/django.mo +0 -0
  1084. wagtail/images/locale/it/LC_MESSAGES/django.po +2 -2
  1085. wagtail/images/locale/ja/LC_MESSAGES/django.po +1 -1
  1086. wagtail/images/locale/ka/LC_MESSAGES/django.po +1 -1
  1087. wagtail/images/locale/ko/LC_MESSAGES/django.mo +0 -0
  1088. wagtail/images/locale/ko/LC_MESSAGES/django.po +31 -2
  1089. wagtail/images/locale/lt/LC_MESSAGES/django.po +1 -1
  1090. wagtail/images/locale/lv/LC_MESSAGES/django.po +1 -1
  1091. wagtail/images/locale/mi/LC_MESSAGES/django.po +1 -1
  1092. wagtail/images/locale/mn/LC_MESSAGES/django.mo +0 -0
  1093. wagtail/images/locale/mn/LC_MESSAGES/django.po +3 -2
  1094. wagtail/images/locale/my/LC_MESSAGES/django.po +1 -1
  1095. wagtail/images/locale/nb/LC_MESSAGES/django.mo +0 -0
  1096. wagtail/images/locale/nb/LC_MESSAGES/django.po +3 -2
  1097. wagtail/images/locale/nl/LC_MESSAGES/django.mo +0 -0
  1098. wagtail/images/locale/nl/LC_MESSAGES/django.po +4 -5
  1099. wagtail/images/locale/pl/LC_MESSAGES/django.mo +0 -0
  1100. wagtail/images/locale/pl/LC_MESSAGES/django.po +2 -2
  1101. wagtail/images/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
  1102. wagtail/images/locale/pt_BR/LC_MESSAGES/django.po +2 -2
  1103. wagtail/images/locale/pt_PT/LC_MESSAGES/django.po +1 -1
  1104. wagtail/images/locale/ro/LC_MESSAGES/django.mo +0 -0
  1105. wagtail/images/locale/ro/LC_MESSAGES/django.po +3 -2
  1106. wagtail/images/locale/ru/LC_MESSAGES/django.mo +0 -0
  1107. wagtail/images/locale/ru/LC_MESSAGES/django.po +5 -2
  1108. wagtail/images/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
  1109. wagtail/images/locale/sk_SK/LC_MESSAGES/django.po +2 -2
  1110. wagtail/images/locale/sl/LC_MESSAGES/django.mo +0 -0
  1111. wagtail/images/locale/sl/LC_MESSAGES/django.po +2 -2
  1112. wagtail/images/locale/sv/LC_MESSAGES/django.mo +0 -0
  1113. wagtail/images/locale/sv/LC_MESSAGES/django.po +2 -2
  1114. wagtail/images/locale/tet/LC_MESSAGES/django.po +1 -1
  1115. wagtail/images/locale/th/LC_MESSAGES/django.po +1 -1
  1116. wagtail/images/locale/tr/LC_MESSAGES/django.po +1 -1
  1117. wagtail/images/locale/tr_TR/LC_MESSAGES/django.po +1 -1
  1118. wagtail/images/locale/ug/LC_MESSAGES/django.po +1 -1
  1119. wagtail/images/locale/uk/LC_MESSAGES/django.mo +0 -0
  1120. wagtail/images/locale/uk/LC_MESSAGES/django.po +5 -4
  1121. wagtail/images/locale/vi/LC_MESSAGES/django.po +1 -1
  1122. wagtail/images/locale/zh/LC_MESSAGES/django.po +1 -1
  1123. wagtail/images/locale/zh_Hans/LC_MESSAGES/django.po +2 -1
  1124. wagtail/images/locale/zh_Hant/LC_MESSAGES/django.po +1 -1
  1125. wagtail/images/management/commands/wagtail_update_image_renditions.py +1 -1
  1126. wagtail/images/models.py +23 -7
  1127. wagtail/images/signal_handlers.py +1 -1
  1128. wagtail/images/tests/test_admin_views.py +1 -1
  1129. wagtail/images/tests/test_models.py +39 -3
  1130. wagtail/images/tests/tests.py +0 -6
  1131. wagtail/images/wagtail_hooks.py +2 -2
  1132. wagtail/locale/af/LC_MESSAGES/django.po +1 -1
  1133. wagtail/locale/ar/LC_MESSAGES/django.mo +0 -0
  1134. wagtail/locale/ar/LC_MESSAGES/django.po +59 -50
  1135. wagtail/locale/az_AZ/LC_MESSAGES/django.po +1 -1
  1136. wagtail/locale/be/LC_MESSAGES/django.mo +0 -0
  1137. wagtail/locale/be/LC_MESSAGES/django.po +55 -51
  1138. wagtail/locale/bg/LC_MESSAGES/django.mo +0 -0
  1139. wagtail/locale/bg/LC_MESSAGES/django.po +7 -4
  1140. wagtail/locale/bn/LC_MESSAGES/django.mo +0 -0
  1141. wagtail/locale/bn/LC_MESSAGES/django.po +7 -1
  1142. wagtail/locale/ca/LC_MESSAGES/django.mo +0 -0
  1143. wagtail/locale/ca/LC_MESSAGES/django.po +243 -234
  1144. wagtail/locale/cs/LC_MESSAGES/django.mo +0 -0
  1145. wagtail/locale/cs/LC_MESSAGES/django.po +181 -172
  1146. wagtail/locale/cy/LC_MESSAGES/django.mo +0 -0
  1147. wagtail/locale/cy/LC_MESSAGES/django.po +18 -12
  1148. wagtail/locale/da/LC_MESSAGES/django.mo +0 -0
  1149. wagtail/locale/da/LC_MESSAGES/django.po +16 -7
  1150. wagtail/locale/de/LC_MESSAGES/django.mo +0 -0
  1151. wagtail/locale/de/LC_MESSAGES/django.po +248 -238
  1152. wagtail/locale/dv/LC_MESSAGES/django.mo +0 -0
  1153. wagtail/locale/dv/LC_MESSAGES/django.po +225 -215
  1154. wagtail/locale/el/LC_MESSAGES/django.mo +0 -0
  1155. wagtail/locale/el/LC_MESSAGES/django.po +85 -75
  1156. wagtail/locale/en/LC_MESSAGES/django.po +339 -339
  1157. wagtail/locale/es/LC_MESSAGES/django.mo +0 -0
  1158. wagtail/locale/es/LC_MESSAGES/django.po +201 -192
  1159. wagtail/locale/es_419/LC_MESSAGES/django.mo +0 -0
  1160. wagtail/locale/es_419/LC_MESSAGES/django.po +7 -1
  1161. wagtail/locale/et/LC_MESSAGES/django.mo +0 -0
  1162. wagtail/locale/et/LC_MESSAGES/django.po +176 -173
  1163. wagtail/locale/eu/LC_MESSAGES/django.po +1 -1
  1164. wagtail/locale/fa/LC_MESSAGES/django.mo +0 -0
  1165. wagtail/locale/fa/LC_MESSAGES/django.po +59 -50
  1166. wagtail/locale/fi/LC_MESSAGES/django.mo +0 -0
  1167. wagtail/locale/fi/LC_MESSAGES/django.po +198 -189
  1168. wagtail/locale/fr/LC_MESSAGES/django.mo +0 -0
  1169. wagtail/locale/fr/LC_MESSAGES/django.po +245 -235
  1170. wagtail/locale/gl/LC_MESSAGES/django.mo +0 -0
  1171. wagtail/locale/gl/LC_MESSAGES/django.po +244 -235
  1172. wagtail/locale/he_IL/LC_MESSAGES/django.mo +0 -0
  1173. wagtail/locale/he_IL/LC_MESSAGES/django.po +12 -9
  1174. wagtail/locale/hr_HR/LC_MESSAGES/django.mo +0 -0
  1175. wagtail/locale/hr_HR/LC_MESSAGES/django.po +187 -184
  1176. wagtail/locale/hu/LC_MESSAGES/django.mo +0 -0
  1177. wagtail/locale/hu/LC_MESSAGES/django.po +260 -229
  1178. wagtail/locale/id_ID/LC_MESSAGES/django.mo +0 -0
  1179. wagtail/locale/id_ID/LC_MESSAGES/django.po +52 -49
  1180. wagtail/locale/is_IS/LC_MESSAGES/django.mo +0 -0
  1181. wagtail/locale/is_IS/LC_MESSAGES/django.po +241 -232
  1182. wagtail/locale/it/LC_MESSAGES/django.mo +0 -0
  1183. wagtail/locale/it/LC_MESSAGES/django.po +233 -224
  1184. wagtail/locale/ja/LC_MESSAGES/django.mo +0 -0
  1185. wagtail/locale/ja/LC_MESSAGES/django.po +119 -110
  1186. wagtail/locale/ka/LC_MESSAGES/django.po +4 -4
  1187. wagtail/locale/ko/LC_MESSAGES/django.mo +0 -0
  1188. wagtail/locale/ko/LC_MESSAGES/django.po +95 -51
  1189. wagtail/locale/lt/LC_MESSAGES/django.mo +0 -0
  1190. wagtail/locale/lt/LC_MESSAGES/django.po +62 -53
  1191. wagtail/locale/lv/LC_MESSAGES/django.mo +0 -0
  1192. wagtail/locale/lv/LC_MESSAGES/django.po +25 -22
  1193. wagtail/locale/mi/LC_MESSAGES/django.po +167 -167
  1194. wagtail/locale/mn/LC_MESSAGES/django.mo +0 -0
  1195. wagtail/locale/mn/LC_MESSAGES/django.po +54 -50
  1196. wagtail/locale/my/LC_MESSAGES/django.po +6 -6
  1197. wagtail/locale/nb/LC_MESSAGES/django.mo +0 -0
  1198. wagtail/locale/nb/LC_MESSAGES/django.po +59 -50
  1199. wagtail/locale/nl/LC_MESSAGES/django.mo +0 -0
  1200. wagtail/locale/nl/LC_MESSAGES/django.po +242 -233
  1201. wagtail/locale/pl/LC_MESSAGES/django.mo +0 -0
  1202. wagtail/locale/pl/LC_MESSAGES/django.po +241 -232
  1203. wagtail/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
  1204. wagtail/locale/pt_BR/LC_MESSAGES/django.po +211 -202
  1205. wagtail/locale/pt_PT/LC_MESSAGES/django.mo +0 -0
  1206. wagtail/locale/pt_PT/LC_MESSAGES/django.po +191 -180
  1207. wagtail/locale/ro/LC_MESSAGES/django.mo +0 -0
  1208. wagtail/locale/ro/LC_MESSAGES/django.po +242 -232
  1209. wagtail/locale/ru/LC_MESSAGES/django.mo +0 -0
  1210. wagtail/locale/ru/LC_MESSAGES/django.po +246 -234
  1211. wagtail/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
  1212. wagtail/locale/sk_SK/LC_MESSAGES/django.po +50 -47
  1213. wagtail/locale/sl/LC_MESSAGES/django.mo +0 -0
  1214. wagtail/locale/sl/LC_MESSAGES/django.po +242 -233
  1215. wagtail/locale/sv/LC_MESSAGES/django.mo +0 -0
  1216. wagtail/locale/sv/LC_MESSAGES/django.po +216 -207
  1217. wagtail/locale/tet/LC_MESSAGES/django.mo +0 -0
  1218. wagtail/locale/tet/LC_MESSAGES/django.po +40 -37
  1219. wagtail/locale/th/LC_MESSAGES/django.mo +0 -0
  1220. wagtail/locale/th/LC_MESSAGES/django.po +57 -53
  1221. wagtail/locale/tr/LC_MESSAGES/django.mo +0 -0
  1222. wagtail/locale/tr/LC_MESSAGES/django.po +53 -50
  1223. wagtail/locale/tr_TR/LC_MESSAGES/django.mo +0 -0
  1224. wagtail/locale/tr_TR/LC_MESSAGES/django.po +53 -50
  1225. wagtail/locale/ug/LC_MESSAGES/django.mo +0 -0
  1226. wagtail/locale/ug/LC_MESSAGES/django.po +241 -232
  1227. wagtail/locale/uk/LC_MESSAGES/django.mo +0 -0
  1228. wagtail/locale/uk/LC_MESSAGES/django.po +194 -185
  1229. wagtail/locale/vi/LC_MESSAGES/django.mo +0 -0
  1230. wagtail/locale/vi/LC_MESSAGES/django.po +20 -19
  1231. wagtail/locale/zh/LC_MESSAGES/django.mo +0 -0
  1232. wagtail/locale/zh/LC_MESSAGES/django.po +7 -4
  1233. wagtail/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  1234. wagtail/locale/zh_Hans/LC_MESSAGES/django.po +198 -189
  1235. wagtail/locale/zh_Hant/LC_MESSAGES/django.mo +0 -0
  1236. wagtail/locale/zh_Hant/LC_MESSAGES/django.po +164 -161
  1237. wagtail/locales/locale/ar/LC_MESSAGES/django.po +1 -1
  1238. wagtail/locales/locale/be/LC_MESSAGES/django.po +1 -1
  1239. wagtail/locales/locale/bg/LC_MESSAGES/django.po +1 -1
  1240. wagtail/locales/locale/ca/LC_MESSAGES/django.mo +0 -0
  1241. wagtail/locales/locale/ca/LC_MESSAGES/django.po +13 -3
  1242. wagtail/locales/locale/cs/LC_MESSAGES/django.po +1 -1
  1243. wagtail/locales/locale/cy/LC_MESSAGES/django.po +1 -1
  1244. wagtail/locales/locale/da/LC_MESSAGES/django.po +1 -1
  1245. wagtail/locales/locale/de/LC_MESSAGES/django.mo +0 -0
  1246. wagtail/locales/locale/de/LC_MESSAGES/django.po +13 -2
  1247. wagtail/locales/locale/dv/LC_MESSAGES/django.po +1 -1
  1248. wagtail/locales/locale/el/LC_MESSAGES/django.po +1 -1
  1249. wagtail/locales/locale/en/LC_MESSAGES/django.po +26 -14
  1250. wagtail/locales/locale/es/LC_MESSAGES/django.po +1 -1
  1251. wagtail/locales/locale/et/LC_MESSAGES/django.po +1 -1
  1252. wagtail/locales/locale/fa/LC_MESSAGES/django.po +1 -1
  1253. wagtail/locales/locale/fi/LC_MESSAGES/django.po +1 -1
  1254. wagtail/locales/locale/fr/LC_MESSAGES/django.mo +0 -0
  1255. wagtail/locales/locale/fr/LC_MESSAGES/django.po +14 -2
  1256. wagtail/locales/locale/gl/LC_MESSAGES/django.mo +0 -0
  1257. wagtail/locales/locale/gl/LC_MESSAGES/django.po +13 -3
  1258. wagtail/locales/locale/he_IL/LC_MESSAGES/django.po +3 -3
  1259. wagtail/locales/locale/hr_HR/LC_MESSAGES/django.po +3 -3
  1260. wagtail/locales/locale/hu/LC_MESSAGES/django.po +1 -1
  1261. wagtail/locales/locale/id_ID/LC_MESSAGES/django.po +1 -1
  1262. wagtail/locales/locale/is_IS/LC_MESSAGES/django.po +3 -3
  1263. wagtail/locales/locale/it/LC_MESSAGES/django.po +1 -1
  1264. wagtail/locales/locale/ja/LC_MESSAGES/django.po +1 -1
  1265. wagtail/locales/locale/ko/LC_MESSAGES/django.po +1 -1
  1266. wagtail/locales/locale/lt/LC_MESSAGES/django.po +1 -1
  1267. wagtail/locales/locale/lv/LC_MESSAGES/django.po +1 -1
  1268. wagtail/locales/locale/mi/LC_MESSAGES/django.po +1 -1
  1269. wagtail/locales/locale/mn/LC_MESSAGES/django.po +1 -1
  1270. wagtail/locales/locale/my/LC_MESSAGES/django.po +1 -1
  1271. wagtail/locales/locale/nb/LC_MESSAGES/django.po +3 -3
  1272. wagtail/locales/locale/nl/LC_MESSAGES/django.po +1 -1
  1273. wagtail/locales/locale/pl/LC_MESSAGES/django.po +1 -1
  1274. wagtail/locales/locale/pt_BR/LC_MESSAGES/django.po +3 -3
  1275. wagtail/locales/locale/pt_PT/LC_MESSAGES/django.po +1 -1
  1276. wagtail/locales/locale/ro/LC_MESSAGES/django.po +1 -1
  1277. wagtail/locales/locale/ru/LC_MESSAGES/django.po +1 -1
  1278. wagtail/locales/locale/sk_SK/LC_MESSAGES/django.po +3 -3
  1279. wagtail/locales/locale/sl/LC_MESSAGES/django.po +1 -1
  1280. wagtail/locales/locale/sv/LC_MESSAGES/django.po +1 -1
  1281. wagtail/locales/locale/tet/LC_MESSAGES/django.po +1 -1
  1282. wagtail/locales/locale/th/LC_MESSAGES/django.po +1 -1
  1283. wagtail/locales/locale/tr/LC_MESSAGES/django.po +1 -1
  1284. wagtail/locales/locale/tr_TR/LC_MESSAGES/django.po +3 -3
  1285. wagtail/locales/locale/ug/LC_MESSAGES/django.po +1 -1
  1286. wagtail/locales/locale/uk/LC_MESSAGES/django.po +1 -1
  1287. wagtail/locales/locale/vi/LC_MESSAGES/django.po +1 -1
  1288. wagtail/locales/locale/zh/LC_MESSAGES/django.po +1 -1
  1289. wagtail/locales/locale/zh_Hans/LC_MESSAGES/django.po +3 -3
  1290. wagtail/locales/locale/zh_Hant/LC_MESSAGES/django.po +3 -3
  1291. wagtail/locales/tests.py +32 -1
  1292. wagtail/locales/views.py +39 -7
  1293. wagtail/models/__init__.py +67 -5002
  1294. wagtail/models/audit_log.py +1 -1
  1295. wagtail/models/content_types.py +11 -0
  1296. wagtail/models/draft_state.py +197 -0
  1297. wagtail/models/locking.py +82 -0
  1298. wagtail/models/orderable.py +10 -0
  1299. wagtail/models/pages.py +2755 -0
  1300. wagtail/models/preview.py +281 -0
  1301. wagtail/models/reference_index.py +1 -1
  1302. wagtail/models/revisions.py +433 -0
  1303. wagtail/models/view_restrictions.py +3 -3
  1304. wagtail/models/workflows.py +1348 -0
  1305. wagtail/project_template/home/apps.py +6 -0
  1306. wagtail/project_template/manage.py-tpl +22 -0
  1307. wagtail/project_template/project_name/settings/base.py +1 -0
  1308. wagtail/project_template/requirements.txt +2 -2
  1309. wagtail/search/backends/base.py +10 -5
  1310. wagtail/search/backends/database/fallback.py +3 -0
  1311. wagtail/search/backends/database/mysql/mysql.py +9 -2
  1312. wagtail/search/backends/database/mysql/query.py +8 -4
  1313. wagtail/search/backends/database/postgres/postgres.py +3 -0
  1314. wagtail/search/backends/database/sqlite/sqlite.py +3 -0
  1315. wagtail/search/backends/elasticsearch7.py +20 -7
  1316. wagtail/search/locale/ar/LC_MESSAGES/django.po +1 -1
  1317. wagtail/search/locale/be/LC_MESSAGES/django.po +1 -1
  1318. wagtail/search/locale/ca/LC_MESSAGES/django.po +1 -1
  1319. wagtail/search/locale/cs/LC_MESSAGES/django.po +1 -1
  1320. wagtail/search/locale/cy/LC_MESSAGES/django.po +1 -1
  1321. wagtail/search/locale/de/LC_MESSAGES/django.po +1 -1
  1322. wagtail/search/locale/dv/LC_MESSAGES/django.po +1 -1
  1323. wagtail/search/locale/en/LC_MESSAGES/django.po +1 -1
  1324. wagtail/search/locale/es/LC_MESSAGES/django.po +1 -1
  1325. wagtail/search/locale/et/LC_MESSAGES/django.po +1 -1
  1326. wagtail/search/locale/fa/LC_MESSAGES/django.po +1 -1
  1327. wagtail/search/locale/fi/LC_MESSAGES/django.po +1 -1
  1328. wagtail/search/locale/fr/LC_MESSAGES/django.po +1 -1
  1329. wagtail/search/locale/gl/LC_MESSAGES/django.po +1 -1
  1330. wagtail/search/locale/hr_HR/LC_MESSAGES/django.po +1 -1
  1331. wagtail/search/locale/ht/LC_MESSAGES/django.po +1 -1
  1332. wagtail/search/locale/hu/LC_MESSAGES/django.po +1 -1
  1333. wagtail/search/locale/id_ID/LC_MESSAGES/django.po +1 -1
  1334. wagtail/search/locale/is_IS/LC_MESSAGES/django.po +1 -1
  1335. wagtail/search/locale/it/LC_MESSAGES/django.po +1 -1
  1336. wagtail/search/locale/ja/LC_MESSAGES/django.po +1 -1
  1337. wagtail/search/locale/ko/LC_MESSAGES/django.po +1 -1
  1338. wagtail/search/locale/lt/LC_MESSAGES/django.po +1 -1
  1339. wagtail/search/locale/mi/LC_MESSAGES/django.po +1 -1
  1340. wagtail/search/locale/mn/LC_MESSAGES/django.po +1 -1
  1341. wagtail/search/locale/my/LC_MESSAGES/django.po +1 -1
  1342. wagtail/search/locale/nb/LC_MESSAGES/django.po +1 -1
  1343. wagtail/search/locale/nl/LC_MESSAGES/django.po +1 -1
  1344. wagtail/search/locale/pl/LC_MESSAGES/django.po +1 -1
  1345. wagtail/search/locale/pt_BR/LC_MESSAGES/django.po +1 -1
  1346. wagtail/search/locale/pt_PT/LC_MESSAGES/django.po +1 -1
  1347. wagtail/search/locale/ro/LC_MESSAGES/django.po +1 -1
  1348. wagtail/search/locale/ru/LC_MESSAGES/django.po +1 -1
  1349. wagtail/search/locale/sl/LC_MESSAGES/django.po +1 -1
  1350. wagtail/search/locale/sv/LC_MESSAGES/django.po +1 -1
  1351. wagtail/search/locale/tet/LC_MESSAGES/django.po +1 -1
  1352. wagtail/search/locale/th/LC_MESSAGES/django.po +1 -1
  1353. wagtail/search/locale/tr/LC_MESSAGES/django.po +1 -1
  1354. wagtail/search/locale/tr_TR/LC_MESSAGES/django.po +1 -1
  1355. wagtail/search/locale/ug/LC_MESSAGES/django.po +1 -1
  1356. wagtail/search/locale/uk/LC_MESSAGES/django.po +1 -1
  1357. wagtail/search/locale/vi/LC_MESSAGES/django.po +1 -1
  1358. wagtail/search/locale/zh_Hans/LC_MESSAGES/django.po +1 -1
  1359. wagtail/search/locale/zh_Hant/LC_MESSAGES/django.po +1 -1
  1360. wagtail/search/signal_handlers.py +1 -1
  1361. wagtail/search/tests/elasticsearch_common_tests.py +43 -0
  1362. wagtail/search/tests/test_backends.py +50 -13
  1363. wagtail/search/tests/test_index_functions.py +27 -1
  1364. wagtail/search/tests/test_mysql_backend.py +97 -0
  1365. wagtail/search/tests/test_page_search.py +2 -1
  1366. wagtail/search/tests/test_queries.py +2 -2
  1367. wagtail/signal_handlers.py +1 -1
  1368. wagtail/sites/locale/ar/LC_MESSAGES/django.po +1 -1
  1369. wagtail/sites/locale/be/LC_MESSAGES/django.po +1 -1
  1370. wagtail/sites/locale/bn/LC_MESSAGES/django.po +1 -1
  1371. wagtail/sites/locale/ca/LC_MESSAGES/django.po +1 -1
  1372. wagtail/sites/locale/cs/LC_MESSAGES/django.po +1 -1
  1373. wagtail/sites/locale/cy/LC_MESSAGES/django.po +1 -1
  1374. wagtail/sites/locale/da/LC_MESSAGES/django.po +1 -1
  1375. wagtail/sites/locale/de/LC_MESSAGES/django.po +1 -1
  1376. wagtail/sites/locale/dv/LC_MESSAGES/django.po +1 -1
  1377. wagtail/sites/locale/el/LC_MESSAGES/django.po +1 -1
  1378. wagtail/sites/locale/en/LC_MESSAGES/django.po +1 -1
  1379. wagtail/sites/locale/en_IN/LC_MESSAGES/django.po +1 -1
  1380. wagtail/sites/locale/es/LC_MESSAGES/django.po +1 -1
  1381. wagtail/sites/locale/es_419/LC_MESSAGES/django.po +1 -1
  1382. wagtail/sites/locale/es_VE/LC_MESSAGES/django.po +1 -1
  1383. wagtail/sites/locale/et/LC_MESSAGES/django.po +1 -1
  1384. wagtail/sites/locale/fa/LC_MESSAGES/django.po +1 -1
  1385. wagtail/sites/locale/fi/LC_MESSAGES/django.po +1 -1
  1386. wagtail/sites/locale/fr/LC_MESSAGES/django.po +1 -1
  1387. wagtail/sites/locale/gl/LC_MESSAGES/django.po +1 -1
  1388. wagtail/sites/locale/he_IL/LC_MESSAGES/django.po +1 -1
  1389. wagtail/sites/locale/hi/LC_MESSAGES/django.po +1 -1
  1390. wagtail/sites/locale/hr_HR/LC_MESSAGES/django.po +1 -1
  1391. wagtail/sites/locale/ht/LC_MESSAGES/django.po +1 -1
  1392. wagtail/sites/locale/hu/LC_MESSAGES/django.po +1 -1
  1393. wagtail/sites/locale/id_ID/LC_MESSAGES/django.po +1 -1
  1394. wagtail/sites/locale/is_IS/LC_MESSAGES/django.po +1 -1
  1395. wagtail/sites/locale/it/LC_MESSAGES/django.po +1 -1
  1396. wagtail/sites/locale/ja/LC_MESSAGES/django.po +1 -1
  1397. wagtail/sites/locale/ka/LC_MESSAGES/django.po +1 -1
  1398. wagtail/sites/locale/ko/LC_MESSAGES/django.po +1 -1
  1399. wagtail/sites/locale/lt/LC_MESSAGES/django.po +1 -1
  1400. wagtail/sites/locale/lv/LC_MESSAGES/django.po +1 -1
  1401. wagtail/sites/locale/mi/LC_MESSAGES/django.po +1 -1
  1402. wagtail/sites/locale/mn/LC_MESSAGES/django.po +1 -1
  1403. wagtail/sites/locale/my/LC_MESSAGES/django.po +1 -1
  1404. wagtail/sites/locale/nb/LC_MESSAGES/django.po +1 -1
  1405. wagtail/sites/locale/nl/LC_MESSAGES/django.po +1 -1
  1406. wagtail/sites/locale/pl/LC_MESSAGES/django.po +1 -1
  1407. wagtail/sites/locale/pt_BR/LC_MESSAGES/django.po +1 -1
  1408. wagtail/sites/locale/pt_PT/LC_MESSAGES/django.po +1 -1
  1409. wagtail/sites/locale/ro/LC_MESSAGES/django.po +1 -1
  1410. wagtail/sites/locale/ru/LC_MESSAGES/django.po +1 -1
  1411. wagtail/sites/locale/sk_SK/LC_MESSAGES/django.po +1 -1
  1412. wagtail/sites/locale/sl/LC_MESSAGES/django.po +1 -1
  1413. wagtail/sites/locale/sr/LC_MESSAGES/django.po +1 -1
  1414. wagtail/sites/locale/sv/LC_MESSAGES/django.po +1 -1
  1415. wagtail/sites/locale/ta/LC_MESSAGES/django.po +1 -1
  1416. wagtail/sites/locale/tet/LC_MESSAGES/django.po +1 -1
  1417. wagtail/sites/locale/th/LC_MESSAGES/django.po +1 -1
  1418. wagtail/sites/locale/tr/LC_MESSAGES/django.po +1 -1
  1419. wagtail/sites/locale/tr_TR/LC_MESSAGES/django.po +1 -1
  1420. wagtail/sites/locale/ug/LC_MESSAGES/django.po +1 -1
  1421. wagtail/sites/locale/uk/LC_MESSAGES/django.po +1 -1
  1422. wagtail/sites/locale/vi/LC_MESSAGES/django.po +1 -1
  1423. wagtail/sites/locale/zh_Hans/LC_MESSAGES/django.po +1 -1
  1424. wagtail/sites/locale/zh_Hant/LC_MESSAGES/django.po +1 -1
  1425. wagtail/snippets/action_menu.py +9 -30
  1426. wagtail/snippets/locale/af/LC_MESSAGES/django.po +1 -1
  1427. wagtail/snippets/locale/ar/LC_MESSAGES/django.po +4 -4
  1428. wagtail/snippets/locale/az_AZ/LC_MESSAGES/django.po +4 -4
  1429. wagtail/snippets/locale/be/LC_MESSAGES/django.mo +0 -0
  1430. wagtail/snippets/locale/be/LC_MESSAGES/django.po +6 -5
  1431. wagtail/snippets/locale/bg/LC_MESSAGES/django.po +4 -4
  1432. wagtail/snippets/locale/bn/LC_MESSAGES/django.po +4 -4
  1433. wagtail/snippets/locale/ca/LC_MESSAGES/django.mo +0 -0
  1434. wagtail/snippets/locale/ca/LC_MESSAGES/django.po +11 -13
  1435. wagtail/snippets/locale/cs/LC_MESSAGES/django.po +5 -4
  1436. wagtail/snippets/locale/cy/LC_MESSAGES/django.mo +0 -0
  1437. wagtail/snippets/locale/cy/LC_MESSAGES/django.po +5 -12
  1438. wagtail/snippets/locale/da/LC_MESSAGES/django.po +4 -4
  1439. wagtail/snippets/locale/de/LC_MESSAGES/django.mo +0 -0
  1440. wagtail/snippets/locale/de/LC_MESSAGES/django.po +13 -14
  1441. wagtail/snippets/locale/dv/LC_MESSAGES/django.po +5 -4
  1442. wagtail/snippets/locale/el/LC_MESSAGES/django.po +5 -4
  1443. wagtail/snippets/locale/en/LC_MESSAGES/django.po +31 -23
  1444. wagtail/snippets/locale/en_IN/LC_MESSAGES/django.po +1 -1
  1445. wagtail/snippets/locale/es/LC_MESSAGES/django.mo +0 -0
  1446. wagtail/snippets/locale/es/LC_MESSAGES/django.po +6 -13
  1447. wagtail/snippets/locale/es_419/LC_MESSAGES/django.po +4 -4
  1448. wagtail/snippets/locale/es_VE/LC_MESSAGES/django.po +1 -1
  1449. wagtail/snippets/locale/et/LC_MESSAGES/django.po +4 -4
  1450. wagtail/snippets/locale/eu/LC_MESSAGES/django.po +1 -1
  1451. wagtail/snippets/locale/fa/LC_MESSAGES/django.mo +0 -0
  1452. wagtail/snippets/locale/fa/LC_MESSAGES/django.po +6 -5
  1453. wagtail/snippets/locale/fi/LC_MESSAGES/django.mo +0 -0
  1454. wagtail/snippets/locale/fi/LC_MESSAGES/django.po +6 -9
  1455. wagtail/snippets/locale/fr/LC_MESSAGES/django.mo +0 -0
  1456. wagtail/snippets/locale/fr/LC_MESSAGES/django.po +13 -14
  1457. wagtail/snippets/locale/gl/LC_MESSAGES/django.mo +0 -0
  1458. wagtail/snippets/locale/gl/LC_MESSAGES/django.po +11 -13
  1459. wagtail/snippets/locale/he_IL/LC_MESSAGES/django.po +4 -4
  1460. wagtail/snippets/locale/hi/LC_MESSAGES/django.po +1 -1
  1461. wagtail/snippets/locale/hr_HR/LC_MESSAGES/django.mo +0 -0
  1462. wagtail/snippets/locale/hr_HR/LC_MESSAGES/django.po +4 -12
  1463. wagtail/snippets/locale/ht/LC_MESSAGES/django.po +1 -1
  1464. wagtail/snippets/locale/hu/LC_MESSAGES/django.mo +0 -0
  1465. wagtail/snippets/locale/hu/LC_MESSAGES/django.po +4 -12
  1466. wagtail/snippets/locale/id_ID/LC_MESSAGES/django.po +4 -4
  1467. wagtail/snippets/locale/is_IS/LC_MESSAGES/django.mo +0 -0
  1468. wagtail/snippets/locale/is_IS/LC_MESSAGES/django.po +5 -14
  1469. wagtail/snippets/locale/it/LC_MESSAGES/django.mo +0 -0
  1470. wagtail/snippets/locale/it/LC_MESSAGES/django.po +5 -13
  1471. wagtail/snippets/locale/ja/LC_MESSAGES/django.mo +0 -0
  1472. wagtail/snippets/locale/ja/LC_MESSAGES/django.po +6 -5
  1473. wagtail/snippets/locale/ka/LC_MESSAGES/django.po +4 -4
  1474. wagtail/snippets/locale/ko/LC_MESSAGES/django.po +4 -4
  1475. wagtail/snippets/locale/lt/LC_MESSAGES/django.po +4 -4
  1476. wagtail/snippets/locale/lv/LC_MESSAGES/django.po +4 -4
  1477. wagtail/snippets/locale/mi/LC_MESSAGES/django.po +4 -4
  1478. wagtail/snippets/locale/mn/LC_MESSAGES/django.po +4 -4
  1479. wagtail/snippets/locale/my/LC_MESSAGES/django.po +4 -4
  1480. wagtail/snippets/locale/nb/LC_MESSAGES/django.mo +0 -0
  1481. wagtail/snippets/locale/nb/LC_MESSAGES/django.po +5 -12
  1482. wagtail/snippets/locale/nl/LC_MESSAGES/django.mo +0 -0
  1483. wagtail/snippets/locale/nl/LC_MESSAGES/django.po +12 -13
  1484. wagtail/snippets/locale/pl/LC_MESSAGES/django.mo +0 -0
  1485. wagtail/snippets/locale/pl/LC_MESSAGES/django.po +5 -13
  1486. wagtail/snippets/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
  1487. wagtail/snippets/locale/pt_BR/LC_MESSAGES/django.po +7 -13
  1488. wagtail/snippets/locale/pt_PT/LC_MESSAGES/django.mo +0 -0
  1489. wagtail/snippets/locale/pt_PT/LC_MESSAGES/django.po +7 -5
  1490. wagtail/snippets/locale/ro/LC_MESSAGES/django.mo +0 -0
  1491. wagtail/snippets/locale/ro/LC_MESSAGES/django.po +6 -13
  1492. wagtail/snippets/locale/ru/LC_MESSAGES/django.mo +0 -0
  1493. wagtail/snippets/locale/ru/LC_MESSAGES/django.po +6 -13
  1494. wagtail/snippets/locale/sk_SK/LC_MESSAGES/django.po +4 -4
  1495. wagtail/snippets/locale/sl/LC_MESSAGES/django.mo +0 -0
  1496. wagtail/snippets/locale/sl/LC_MESSAGES/django.po +5 -13
  1497. wagtail/snippets/locale/sr/LC_MESSAGES/django.po +1 -1
  1498. wagtail/snippets/locale/sv/LC_MESSAGES/django.mo +0 -0
  1499. wagtail/snippets/locale/sv/LC_MESSAGES/django.po +5 -13
  1500. wagtail/snippets/locale/ta/LC_MESSAGES/django.po +1 -1
  1501. wagtail/snippets/locale/tet/LC_MESSAGES/django.po +4 -4
  1502. wagtail/snippets/locale/th/LC_MESSAGES/django.mo +0 -0
  1503. wagtail/snippets/locale/th/LC_MESSAGES/django.po +6 -5
  1504. wagtail/snippets/locale/tr/LC_MESSAGES/django.po +4 -4
  1505. wagtail/snippets/locale/tr_TR/LC_MESSAGES/django.po +4 -4
  1506. wagtail/snippets/locale/ug/LC_MESSAGES/django.mo +0 -0
  1507. wagtail/snippets/locale/ug/LC_MESSAGES/django.po +4 -12
  1508. wagtail/snippets/locale/uk/LC_MESSAGES/django.mo +0 -0
  1509. wagtail/snippets/locale/uk/LC_MESSAGES/django.po +6 -6
  1510. wagtail/snippets/locale/vi/LC_MESSAGES/django.po +4 -4
  1511. wagtail/snippets/locale/zh/LC_MESSAGES/django.po +4 -4
  1512. wagtail/snippets/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  1513. wagtail/snippets/locale/zh_Hans/LC_MESSAGES/django.po +6 -13
  1514. wagtail/snippets/locale/zh_Hant/LC_MESSAGES/django.po +4 -4
  1515. wagtail/snippets/permissions.py +6 -4
  1516. wagtail/snippets/static/wagtailsnippets/js/snippet-chooser-telepath.js +1 -1
  1517. wagtail/snippets/static/wagtailsnippets/js/snippet-chooser.js +1 -1
  1518. wagtail/snippets/templates/wagtailsnippets/snippets/action_menu/publish.html +3 -5
  1519. wagtail/snippets/tests/test_preview.py +62 -38
  1520. wagtail/snippets/tests/test_snippets.py +313 -130
  1521. wagtail/snippets/tests/test_viewset.py +69 -6
  1522. wagtail/snippets/tests/test_workflows.py +0 -4
  1523. wagtail/snippets/views/snippets.py +29 -53
  1524. wagtail/snippets/wagtail_hooks.py +3 -7
  1525. wagtail/templates/wagtailcore/shared/block_preview.html +9 -1
  1526. wagtail/test/apps.py +5 -0
  1527. wagtail/test/context_processors.py +19 -0
  1528. wagtail/test/customuser/forms.py +19 -0
  1529. wagtail/test/customuser/viewsets.py +12 -0
  1530. wagtail/test/settings.py +8 -9
  1531. wagtail/test/snippets/apps.py +10 -0
  1532. wagtail/test/streamfield_migrations/testutils.py +4 -4
  1533. wagtail/test/testapp/migrations/0046_alter_custom_rendition_to_unique_constraint.py +24 -0
  1534. wagtail/test/testapp/migrations/0047_advertwithcustomuuidprimarykey_page.py +25 -0
  1535. wagtail/test/testapp/migrations/0048_requireddatepage.py +36 -0
  1536. wagtail/test/testapp/migrations/0049_promotionalpage.py +35 -0
  1537. wagtail/test/testapp/migrations/0050_headcountrelatedmodelusingpk_related_page.py +25 -0
  1538. wagtail/test/testapp/migrations/0051_userapprovaltaskstate_userapprovaltask.py +59 -0
  1539. wagtail/test/testapp/models.py +190 -27
  1540. wagtail/test/testapp/templates/tests/workflows/approve_with_style.html +6 -0
  1541. wagtail/test/testapp/views.py +7 -1
  1542. wagtail/test/testapp/wagtail_hooks.py +6 -0
  1543. wagtail/test/utils/form_data.py +1 -0
  1544. wagtail/tests/streamfield_migrations/test_migration_names.py +6 -6
  1545. wagtail/tests/streamfield_migrations/test_migrations.py +46 -1
  1546. wagtail/tests/test_blocks.py +11 -18
  1547. wagtail/tests/test_management_commands.py +1 -1
  1548. wagtail/tests/test_page_model.py +27 -0
  1549. wagtail/tests/test_page_privacy.py +1 -1
  1550. wagtail/tests/test_reference_index.py +39 -0
  1551. wagtail/tests/test_streamfield.py +136 -0
  1552. wagtail/tests/test_utils.py +1 -23
  1553. wagtail/users/forms.py +3 -17
  1554. wagtail/users/locale/ar/LC_MESSAGES/django.po +1 -1
  1555. wagtail/users/locale/be/LC_MESSAGES/django.mo +0 -0
  1556. wagtail/users/locale/be/LC_MESSAGES/django.po +3 -2
  1557. wagtail/users/locale/bg/LC_MESSAGES/django.po +1 -1
  1558. wagtail/users/locale/bn/LC_MESSAGES/django.po +1 -1
  1559. wagtail/users/locale/ca/LC_MESSAGES/django.mo +0 -0
  1560. wagtail/users/locale/ca/LC_MESSAGES/django.po +2 -2
  1561. wagtail/users/locale/cs/LC_MESSAGES/django.po +2 -1
  1562. wagtail/users/locale/cy/LC_MESSAGES/django.po +2 -1
  1563. wagtail/users/locale/da/LC_MESSAGES/django.po +1 -1
  1564. wagtail/users/locale/de/LC_MESSAGES/django.mo +0 -0
  1565. wagtail/users/locale/de/LC_MESSAGES/django.po +3 -3
  1566. wagtail/users/locale/dv/LC_MESSAGES/django.po +2 -1
  1567. wagtail/users/locale/el/LC_MESSAGES/django.po +1 -1
  1568. wagtail/users/locale/en/LC_MESSAGES/django.po +71 -71
  1569. wagtail/users/locale/es/LC_MESSAGES/django.po +1 -1
  1570. wagtail/users/locale/es_419/LC_MESSAGES/django.po +1 -1
  1571. wagtail/users/locale/et/LC_MESSAGES/django.po +1 -1
  1572. wagtail/users/locale/eu/LC_MESSAGES/django.po +1 -1
  1573. wagtail/users/locale/fa/LC_MESSAGES/django.mo +0 -0
  1574. wagtail/users/locale/fa/LC_MESSAGES/django.po +3 -2
  1575. wagtail/users/locale/fi/LC_MESSAGES/django.mo +0 -0
  1576. wagtail/users/locale/fi/LC_MESSAGES/django.po +4 -4
  1577. wagtail/users/locale/fr/LC_MESSAGES/django.mo +0 -0
  1578. wagtail/users/locale/fr/LC_MESSAGES/django.po +4 -2
  1579. wagtail/users/locale/gl/LC_MESSAGES/django.mo +0 -0
  1580. wagtail/users/locale/gl/LC_MESSAGES/django.po +2 -2
  1581. wagtail/users/locale/he_IL/LC_MESSAGES/django.po +1 -1
  1582. wagtail/users/locale/hr_HR/LC_MESSAGES/django.mo +0 -0
  1583. wagtail/users/locale/hr_HR/LC_MESSAGES/django.po +2 -2
  1584. wagtail/users/locale/hu/LC_MESSAGES/django.mo +0 -0
  1585. wagtail/users/locale/hu/LC_MESSAGES/django.po +45 -3
  1586. wagtail/users/locale/hy/LC_MESSAGES/django.po +1 -1
  1587. wagtail/users/locale/id_ID/LC_MESSAGES/django.po +1 -1
  1588. wagtail/users/locale/is_IS/LC_MESSAGES/django.po +1 -1
  1589. wagtail/users/locale/it/LC_MESSAGES/django.mo +0 -0
  1590. wagtail/users/locale/it/LC_MESSAGES/django.po +2 -2
  1591. wagtail/users/locale/ja/LC_MESSAGES/django.po +1 -1
  1592. wagtail/users/locale/ka/LC_MESSAGES/django.po +1 -1
  1593. wagtail/users/locale/ko/LC_MESSAGES/django.mo +0 -0
  1594. wagtail/users/locale/ko/LC_MESSAGES/django.po +47 -2
  1595. wagtail/users/locale/lt/LC_MESSAGES/django.po +1 -1
  1596. wagtail/users/locale/lv/LC_MESSAGES/django.po +1 -1
  1597. wagtail/users/locale/mi/LC_MESSAGES/django.po +1 -1
  1598. wagtail/users/locale/mn/LC_MESSAGES/django.mo +0 -0
  1599. wagtail/users/locale/mn/LC_MESSAGES/django.po +3 -2
  1600. wagtail/users/locale/my/LC_MESSAGES/django.po +1 -1
  1601. wagtail/users/locale/nb/LC_MESSAGES/django.po +2 -1
  1602. wagtail/users/locale/nl/LC_MESSAGES/django.mo +0 -0
  1603. wagtail/users/locale/nl/LC_MESSAGES/django.po +3 -2
  1604. wagtail/users/locale/pl/LC_MESSAGES/django.mo +0 -0
  1605. wagtail/users/locale/pl/LC_MESSAGES/django.po +2 -2
  1606. wagtail/users/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
  1607. wagtail/users/locale/pt_BR/LC_MESSAGES/django.po +3 -2
  1608. wagtail/users/locale/pt_PT/LC_MESSAGES/django.mo +0 -0
  1609. wagtail/users/locale/pt_PT/LC_MESSAGES/django.po +3 -2
  1610. wagtail/users/locale/ro/LC_MESSAGES/django.mo +0 -0
  1611. wagtail/users/locale/ro/LC_MESSAGES/django.po +3 -2
  1612. wagtail/users/locale/ru/LC_MESSAGES/django.mo +0 -0
  1613. wagtail/users/locale/ru/LC_MESSAGES/django.po +4 -2
  1614. wagtail/users/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
  1615. wagtail/users/locale/sk_SK/LC_MESSAGES/django.po +2 -2
  1616. wagtail/users/locale/sl/LC_MESSAGES/django.mo +0 -0
  1617. wagtail/users/locale/sl/LC_MESSAGES/django.po +2 -2
  1618. wagtail/users/locale/sv/LC_MESSAGES/django.mo +0 -0
  1619. wagtail/users/locale/sv/LC_MESSAGES/django.po +2 -2
  1620. wagtail/users/locale/tet/LC_MESSAGES/django.po +1 -1
  1621. wagtail/users/locale/th/LC_MESSAGES/django.mo +0 -0
  1622. wagtail/users/locale/th/LC_MESSAGES/django.po +3 -2
  1623. wagtail/users/locale/tr/LC_MESSAGES/django.po +1 -1
  1624. wagtail/users/locale/tr_TR/LC_MESSAGES/django.po +1 -1
  1625. wagtail/users/locale/ug/LC_MESSAGES/django.po +1 -1
  1626. wagtail/users/locale/uk/LC_MESSAGES/django.mo +0 -0
  1627. wagtail/users/locale/uk/LC_MESSAGES/django.po +3 -2
  1628. wagtail/users/locale/vi/LC_MESSAGES/django.po +2 -1
  1629. wagtail/users/locale/zh/LC_MESSAGES/django.po +1 -1
  1630. wagtail/users/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  1631. wagtail/users/locale/zh_Hans/LC_MESSAGES/django.po +3 -2
  1632. wagtail/users/locale/zh_Hant/LC_MESSAGES/django.po +1 -1
  1633. wagtail/users/models.py +7 -1
  1634. wagtail/users/permission_order.py +16 -2
  1635. wagtail/users/templatetags/wagtailusers_tags.py +3 -31
  1636. wagtail/users/tests/__init__.py +0 -6
  1637. wagtail/users/tests/test_admin_views.py +285 -611
  1638. wagtail/users/views/groups.py +1 -28
  1639. wagtail/users/views/users.py +3 -45
  1640. wagtail/utils/deprecation.py +3 -3
  1641. wagtail/whitelist.py +1 -0
  1642. wagtail/workflows.py +2 -2
  1643. wagtail-7.0.dist-info/METADATA +224 -0
  1644. {wagtail-6.4rc1.dist-info → wagtail-7.0.dist-info}/RECORD +1648 -1631
  1645. {wagtail-6.4rc1.dist-info → wagtail-7.0.dist-info}/WHEEL +1 -1
  1646. wagtail/admin/templates/wagtailadmin/shared/ajax_pagination_nav.html +0 -25
  1647. wagtail/contrib/redirects/locale/az_AZ/LC_MESSAGES/django.po +0 -22
  1648. wagtail/contrib/search_promotions/locale/en_IN/LC_MESSAGES/django.po +0 -22
  1649. wagtail/contrib/search_promotions/locale/hi/LC_MESSAGES/django.po +0 -22
  1650. wagtail/contrib/search_promotions/locale/sr/LC_MESSAGES/django.po +0 -23
  1651. wagtail/project_template/manage.py +0 -10
  1652. wagtail/utils/setup.py +0 -90
  1653. wagtail/utils/widgets.py +0 -46
  1654. wagtail-6.4rc1.dist-info/METADATA +0 -77
  1655. {wagtail-6.4rc1.dist-info → wagtail-7.0.dist-info}/entry_points.txt +0 -0
  1656. {wagtail-6.4rc1.dist-info → wagtail-7.0.dist-info/licenses}/LICENSE +0 -0
  1657. {wagtail-6.4rc1.dist-info → wagtail-7.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,2755 @@
1
+ from __future__ import annotations
2
+
3
+ import functools
4
+ import logging
5
+ import posixpath
6
+ import uuid
7
+
8
+ from django.conf import settings
9
+ from django.contrib.auth.models import Group, Permission
10
+ from django.contrib.contenttypes.fields import GenericRelation
11
+ from django.contrib.contenttypes.models import ContentType
12
+ from django.core import checks
13
+ from django.core.exceptions import (
14
+ FieldDoesNotExist,
15
+ ValidationError,
16
+ )
17
+ from django.db import models, transaction
18
+ from django.db.models import Q, Value
19
+ from django.db.models.expressions import Subquery
20
+ from django.db.models.functions import Concat, Substr
21
+ from django.dispatch import receiver
22
+ from django.http import Http404, HttpRequest, HttpResponse, HttpResponseNotAllowed
23
+ from django.template.response import TemplateResponse
24
+ from django.urls import NoReverseMatch, reverse
25
+ from django.utils import translation as translation
26
+ from django.utils.encoding import force_bytes, force_str
27
+ from django.utils.functional import Promise, cached_property
28
+ from django.utils.text import capfirst, slugify
29
+ from django.utils.translation import gettext_lazy as _
30
+ from modelcluster.fields import ParentalKey
31
+ from modelcluster.models import (
32
+ ClusterableModel,
33
+ )
34
+ from treebeard.mp_tree import MP_Node
35
+
36
+ from wagtail.actions.copy_for_translation import CopyPageForTranslationAction
37
+ from wagtail.actions.copy_page import CopyPageAction
38
+ from wagtail.actions.create_alias import CreatePageAliasAction
39
+ from wagtail.actions.delete_page import DeletePageAction
40
+ from wagtail.actions.move_page import MovePageAction
41
+ from wagtail.actions.publish_page_revision import PublishPageRevisionAction
42
+ from wagtail.actions.unpublish_page import UnpublishPageAction
43
+ from wagtail.compat import HTTPMethod
44
+ from wagtail.coreutils import (
45
+ WAGTAIL_APPEND_SLASH,
46
+ camelcase_to_underscore,
47
+ get_supported_content_language_variant,
48
+ resolve_model_string,
49
+ safe_md5,
50
+ )
51
+ from wagtail.fields import StreamField
52
+ from wagtail.log_actions import log
53
+ from wagtail.query import PageQuerySet
54
+ from wagtail.search import index
55
+ from wagtail.signals import (
56
+ page_published,
57
+ page_slug_changed,
58
+ pre_validate_delete,
59
+ )
60
+ from wagtail.url_routing import RouteResult
61
+ from wagtail.utils.timestamps import ensure_utc
62
+
63
+ from .audit_log import BaseLogEntry, BaseLogEntryManager, LogEntryQuerySet
64
+ from .content_types import get_default_page_content_type
65
+ from .copying import _copy_m2m_relations
66
+ from .draft_state import DraftStateMixin
67
+ from .i18n import Locale, TranslatableMixin
68
+ from .locking import LockableMixin
69
+ from .panels import CommentPanelPlaceholder, PanelPlaceholder
70
+ from .preview import PreviewableMixin
71
+ from .revisions import Revision, RevisionMixin
72
+ from .sites import Site
73
+ from .specific import SpecificMixin
74
+ from .view_restrictions import BaseViewRestriction
75
+ from .workflows import WorkflowMixin
76
+
77
+ logger = logging.getLogger("wagtail")
78
+
79
+ PAGE_TEMPLATE_VAR = "page"
80
+ COMMENTS_RELATION_NAME = getattr(
81
+ settings, "WAGTAIL_COMMENTS_RELATION_NAME", "wagtail_admin_comments"
82
+ )
83
+
84
+
85
+ @receiver(pre_validate_delete, sender=Locale)
86
+ def reassign_root_page_locale_on_delete(sender, instance, **kwargs):
87
+ # if we're deleting the locale used on the root page node, reassign that to a new locale first
88
+ root_page_with_this_locale = Page.objects.filter(depth=1, locale=instance)
89
+ if root_page_with_this_locale.exists():
90
+ # Select the default locale, if one exists and isn't the one being deleted
91
+ try:
92
+ new_locale = Locale.get_default()
93
+ default_locale_is_ok = new_locale != instance
94
+ except (Locale.DoesNotExist, LookupError):
95
+ default_locale_is_ok = False
96
+
97
+ if not default_locale_is_ok:
98
+ # fall back on any remaining locale
99
+ new_locale = Locale.all_objects.exclude(pk=instance.pk).first()
100
+
101
+ root_page_with_this_locale.update(locale=new_locale)
102
+
103
+
104
+ PAGE_MODEL_CLASSES = []
105
+
106
+
107
+ def get_page_models():
108
+ """
109
+ Returns a list of all non-abstract Page model classes defined in this project.
110
+ """
111
+ return PAGE_MODEL_CLASSES.copy()
112
+
113
+
114
+ def get_page_content_types(include_base_page_type=True):
115
+ """
116
+ Returns a queryset of all ContentType objects corresponding to Page model classes.
117
+ """
118
+ models = get_page_models()
119
+ if not include_base_page_type:
120
+ models.remove(Page)
121
+
122
+ content_type_ids = [
123
+ ct.pk for ct in ContentType.objects.get_for_models(*models).values()
124
+ ]
125
+ return ContentType.objects.filter(pk__in=content_type_ids).order_by("model")
126
+
127
+
128
+ @functools.cache
129
+ def get_streamfield_names(model_class):
130
+ return tuple(
131
+ field.name
132
+ for field in model_class._meta.concrete_fields
133
+ if isinstance(field, StreamField)
134
+ )
135
+
136
+
137
+ class BasePageManager(models.Manager):
138
+ def get_queryset(self):
139
+ return self._queryset_class(self.model).order_by("path")
140
+
141
+ def first_common_ancestor_of(self, pages, include_self=False, strict=False):
142
+ """
143
+ This is similar to ``PageQuerySet.first_common_ancestor`` but works
144
+ for a list of pages instead of a queryset.
145
+ """
146
+ if not pages:
147
+ if strict:
148
+ raise self.model.DoesNotExist("Can not find ancestor of empty list")
149
+ return self.model.get_first_root_node()
150
+
151
+ if include_self:
152
+ paths = list({page.path for page in pages})
153
+ else:
154
+ paths = list({page.path[: -self.model.steplen] for page in pages})
155
+
156
+ # This method works on anything, not just file system paths.
157
+ common_parent_path = posixpath.commonprefix(paths)
158
+ extra_chars = len(common_parent_path) % self.model.steplen
159
+ if extra_chars != 0:
160
+ common_parent_path = common_parent_path[:-extra_chars]
161
+
162
+ if common_parent_path == "":
163
+ if strict:
164
+ raise self.model.DoesNotExist("No common ancestor found!")
165
+
166
+ return self.model.get_first_root_node()
167
+
168
+ return self.get(path=common_parent_path)
169
+
170
+ def annotate_parent_page(self, pages):
171
+ """
172
+ Annotates each page with its parent page. This is implemented as a
173
+ manager-only method instead of a QuerySet method so it can be used with
174
+ search results.
175
+
176
+ If given a QuerySet, this method will evaluate it. Only use this method
177
+ when you are ready to consume the queryset, e.g. after pagination has
178
+ been applied. This is typically done in the view's ``get_context_data``
179
+ using ``context["object_list"]``.
180
+
181
+ This method does not return a new queryset, but modifies the existing one,
182
+ to ensure any references to the queryset in the view's context are updated
183
+ (e.g. when using ``context_object_name``).
184
+ """
185
+ parent_page_paths = {
186
+ Page._get_parent_path_from_path(page.path) for page in pages
187
+ }
188
+ parent_pages_by_path = {
189
+ page.path: page
190
+ for page in Page.objects.filter(path__in=parent_page_paths).specific(
191
+ defer=True
192
+ )
193
+ }
194
+ for page in pages:
195
+ parent_page = parent_pages_by_path.get(
196
+ Page._get_parent_path_from_path(page.path)
197
+ )
198
+ page._parent_page = parent_page
199
+
200
+
201
+ PageManager = BasePageManager.from_queryset(PageQuerySet)
202
+
203
+
204
+ class PageBase(models.base.ModelBase):
205
+ """Metaclass for Page"""
206
+
207
+ def __init__(cls, name, bases, dct):
208
+ super().__init__(name, bases, dct)
209
+
210
+ if "template" not in dct:
211
+ # Define a default template path derived from the app name and model name
212
+ cls.template = "{}/{}.html".format(
213
+ cls._meta.app_label,
214
+ camelcase_to_underscore(name),
215
+ )
216
+
217
+ if "ajax_template" not in dct:
218
+ cls.ajax_template = None
219
+
220
+ cls._clean_subpage_models = (
221
+ None # to be filled in on first call to cls.clean_subpage_models
222
+ )
223
+ cls._clean_parent_page_models = (
224
+ None # to be filled in on first call to cls.clean_parent_page_models
225
+ )
226
+
227
+ # All pages should be creatable unless explicitly set otherwise.
228
+ # This attribute is not inheritable.
229
+ if "is_creatable" not in dct:
230
+ cls.is_creatable = not cls._meta.abstract
231
+
232
+ if not cls._meta.abstract:
233
+ # register this type in the list of page content types
234
+ PAGE_MODEL_CLASSES.append(cls)
235
+
236
+
237
+ class AbstractPage(
238
+ WorkflowMixin,
239
+ PreviewableMixin,
240
+ DraftStateMixin,
241
+ LockableMixin,
242
+ RevisionMixin,
243
+ TranslatableMixin,
244
+ SpecificMixin,
245
+ MP_Node,
246
+ ):
247
+ """
248
+ Abstract superclass for Page. According to Django's inheritance rules, managers set on
249
+ abstract models are inherited by subclasses, but managers set on concrete models that are extended
250
+ via multi-table inheritance are not. We therefore need to attach PageManager to an abstract
251
+ superclass to ensure that it is retained by subclasses of Page.
252
+ """
253
+
254
+ objects = PageManager()
255
+
256
+ class Meta:
257
+ abstract = True
258
+
259
+
260
+ # Make sure that this list is sorted by the codename (first item in the tuple)
261
+ # so that we can follow the same order when querying the Permission objects.
262
+ PAGE_PERMISSION_TYPES = [
263
+ ("add_page", _("Add"), _("Add/edit pages you own")),
264
+ ("bulk_delete_page", _("Bulk delete"), _("Delete pages with children")),
265
+ ("change_page", _("Edit"), _("Edit any page")),
266
+ ("lock_page", _("Lock"), _("Lock/unlock pages you've locked")),
267
+ ("publish_page", _("Publish"), _("Publish any page")),
268
+ ("unlock_page", _("Unlock"), _("Unlock any page")),
269
+ ]
270
+
271
+ PAGE_PERMISSION_TYPE_CHOICES = [
272
+ (identifier[:-5], long_label) for identifier, _, long_label in PAGE_PERMISSION_TYPES
273
+ ]
274
+
275
+ PAGE_PERMISSION_CODENAMES = [identifier for identifier, *_ in PAGE_PERMISSION_TYPES]
276
+
277
+
278
+ class Page(AbstractPage, index.Indexed, ClusterableModel, metaclass=PageBase):
279
+ title = models.CharField(
280
+ verbose_name=_("title"),
281
+ max_length=255,
282
+ help_text=_("The page title as you'd like it to be seen by the public"),
283
+ )
284
+ title.required_on_save = True
285
+ # to reflect title of a current draft in the admin UI
286
+ draft_title = models.CharField(max_length=255, editable=False)
287
+ slug = models.SlugField(
288
+ verbose_name=_("slug"),
289
+ allow_unicode=True,
290
+ max_length=255,
291
+ help_text=_(
292
+ "The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/"
293
+ ),
294
+ )
295
+ content_type = models.ForeignKey(
296
+ ContentType,
297
+ verbose_name=_("content type"),
298
+ related_name="pages",
299
+ on_delete=models.SET(get_default_page_content_type),
300
+ )
301
+ content_type.wagtail_reference_index_ignore = True
302
+ url_path = models.TextField(verbose_name=_("URL path"), blank=True, editable=False)
303
+ owner = models.ForeignKey(
304
+ settings.AUTH_USER_MODEL,
305
+ verbose_name=_("owner"),
306
+ null=True,
307
+ blank=True,
308
+ editable=True,
309
+ on_delete=models.SET_NULL,
310
+ related_name="owned_pages",
311
+ )
312
+ owner.wagtail_reference_index_ignore = True
313
+
314
+ seo_title = models.CharField(
315
+ verbose_name=_("title tag"),
316
+ max_length=255,
317
+ blank=True,
318
+ help_text=_(
319
+ "The name of the page displayed on search engine results as the clickable headline."
320
+ ),
321
+ )
322
+
323
+ show_in_menus_default = False
324
+ show_in_menus = models.BooleanField(
325
+ verbose_name=_("show in menus"),
326
+ default=False,
327
+ help_text=_(
328
+ "Whether a link to this page will appear in automatically generated menus"
329
+ ),
330
+ )
331
+ search_description = models.TextField(
332
+ verbose_name=_("meta description"),
333
+ blank=True,
334
+ help_text=_(
335
+ "The descriptive text displayed underneath a headline in search engine results."
336
+ ),
337
+ )
338
+
339
+ latest_revision_created_at = models.DateTimeField(
340
+ verbose_name=_("latest revision created at"), null=True, editable=False
341
+ )
342
+
343
+ _revisions = GenericRelation("wagtailcore.Revision", related_query_name="page")
344
+
345
+ # Add GenericRelation to allow WorkflowState.objects.filter(page=...) queries.
346
+ # There is no need to override the workflow_states property, as the default
347
+ # implementation in WorkflowMixin already ensures that the queryset uses the
348
+ # base Page content type.
349
+ _workflow_states = GenericRelation(
350
+ "wagtailcore.WorkflowState",
351
+ content_type_field="base_content_type",
352
+ object_id_field="object_id",
353
+ related_query_name="page",
354
+ for_concrete_model=False,
355
+ )
356
+
357
+ # When using a specific queryset, accessing the _workflow_states GenericRelation
358
+ # will yield no results. This is because the _workflow_states GenericRelation
359
+ # uses the base_content_type as the content_type_field, which is not the same
360
+ # as the content type of the specific queryset. To work around this, we define
361
+ # a second GenericRelation that uses the specific content_type to be used
362
+ # when working with specific querysets.
363
+ _specific_workflow_states = GenericRelation(
364
+ "wagtailcore.WorkflowState",
365
+ content_type_field="content_type",
366
+ object_id_field="object_id",
367
+ related_query_name="page",
368
+ for_concrete_model=False,
369
+ )
370
+
371
+ # If non-null, this page is an alias of the linked page
372
+ # This means the page is kept in sync with the live version
373
+ # of the linked pages and is not editable by users.
374
+ alias_of = models.ForeignKey(
375
+ "self",
376
+ on_delete=models.SET_NULL,
377
+ null=True,
378
+ blank=True,
379
+ editable=False,
380
+ related_name="aliases",
381
+ )
382
+ alias_of.wagtail_reference_index_ignore = True
383
+
384
+ search_fields = [
385
+ index.SearchField("title", boost=2),
386
+ index.AutocompleteField("title"),
387
+ index.FilterField("title"),
388
+ index.FilterField("id"),
389
+ index.FilterField("live"),
390
+ index.FilterField("owner"),
391
+ index.FilterField("content_type"),
392
+ index.FilterField("path"),
393
+ index.FilterField("depth"),
394
+ index.FilterField("locked"),
395
+ index.FilterField("show_in_menus"),
396
+ index.FilterField("first_published_at"),
397
+ index.FilterField("last_published_at"),
398
+ index.FilterField("latest_revision_created_at"),
399
+ index.FilterField("locale"),
400
+ index.FilterField("translation_key"),
401
+ ]
402
+
403
+ # Do not allow plain Page instances to be created through the Wagtail admin
404
+ is_creatable = False
405
+
406
+ # Define the maximum number of instances this page type can have. Default to unlimited.
407
+ max_count = None
408
+
409
+ # Define the maximum number of instances this page can have under a specific parent. Default to unlimited.
410
+ max_count_per_parent = None
411
+
412
+ # Set the default order for child pages to be shown in the Page index listing
413
+ admin_default_ordering = "-latest_revision_created_at"
414
+
415
+ # An array of additional field names that will not be included when a Page is copied.
416
+ exclude_fields_in_copy = []
417
+ default_exclude_fields_in_copy = [
418
+ "id",
419
+ "depth",
420
+ "numchild",
421
+ "url_path",
422
+ "path",
423
+ "postgres_index_entries",
424
+ "index_entries",
425
+ "latest_revision",
426
+ COMMENTS_RELATION_NAME,
427
+ ]
428
+
429
+ # Real panel classes are defined in wagtail.admin.panels, which we can't import here
430
+ # because it would create a circular import. Instead, define them with placeholders
431
+ # to be replaced with the real classes by `wagtail.admin.panels.model_utils.expand_panel_list`.
432
+ content_panels = [
433
+ PanelPlaceholder("wagtail.admin.panels.TitleFieldPanel", ["title"], {}),
434
+ ]
435
+ promote_panels = [
436
+ PanelPlaceholder(
437
+ "wagtail.admin.panels.MultiFieldPanel",
438
+ [
439
+ [
440
+ "slug",
441
+ "seo_title",
442
+ "search_description",
443
+ ],
444
+ _("For search engines"),
445
+ ],
446
+ {},
447
+ ),
448
+ PanelPlaceholder(
449
+ "wagtail.admin.panels.MultiFieldPanel",
450
+ [
451
+ [
452
+ "show_in_menus",
453
+ ],
454
+ _("For site menus"),
455
+ ],
456
+ {},
457
+ ),
458
+ ]
459
+ settings_panels = [
460
+ PanelPlaceholder("wagtail.admin.panels.PublishingPanel", [], {}),
461
+ CommentPanelPlaceholder(),
462
+ ]
463
+
464
+ # Privacy options for page
465
+ private_page_options = ["password", "groups", "login"]
466
+
467
+ # Allows page types to specify a list of HTTP method names that page instances will
468
+ # respond to. When the request type doesn't match, Wagtail should return a response
469
+ # with a status code of 405.
470
+ allowed_http_methods = [
471
+ HTTPMethod.DELETE,
472
+ HTTPMethod.GET,
473
+ HTTPMethod.HEAD,
474
+ HTTPMethod.OPTIONS,
475
+ HTTPMethod.PATCH,
476
+ HTTPMethod.POST,
477
+ HTTPMethod.PUT,
478
+ ]
479
+
480
+ @staticmethod
481
+ def route_for_request(request: HttpRequest, path: str) -> RouteResult | None:
482
+ """
483
+ Find the page route for the given HTTP request object, and URL path. The route
484
+ result (`page`, `args`, and `kwargs`) will be cached via
485
+ ``request._wagtail_route_for_request``.
486
+ """
487
+ if not hasattr(request, "_wagtail_route_for_request"):
488
+ try:
489
+ # we need a valid Site object for this request in order to proceed
490
+ if site := Site.find_for_request(request):
491
+ path_components = [
492
+ component for component in path.split("/") if component
493
+ ]
494
+ request._wagtail_route_for_request = (
495
+ site.root_page.localized.specific.route(
496
+ request, path_components
497
+ )
498
+ )
499
+ else:
500
+ request._wagtail_route_for_request = None
501
+ except Http404:
502
+ # .route() can raise Http404
503
+ request._wagtail_route_for_request = None
504
+
505
+ return request._wagtail_route_for_request
506
+
507
+ @staticmethod
508
+ def find_for_request(request: HttpRequest, path: str) -> Page | None:
509
+ """
510
+ Find the page for the given HTTP request object, and URL path. The full
511
+ page route will be cached via ``request._wagtail_route_for_request``.
512
+ """
513
+ result = Page.route_for_request(request, path)
514
+ if result is not None:
515
+ return result[0]
516
+
517
+ @classmethod
518
+ def allowed_http_method_names(cls):
519
+ return [
520
+ method.value if hasattr(method, "value") else method
521
+ for method in cls.allowed_http_methods
522
+ ]
523
+
524
+ def __init__(self, *args, **kwargs):
525
+ super().__init__(*args, **kwargs)
526
+ if not self.id:
527
+ # this model is being newly created
528
+ # rather than retrieved from the db;
529
+ if not self.content_type_id:
530
+ # set content type to correctly represent the model class
531
+ # that this was created as
532
+ self.content_type = ContentType.objects.get_for_model(self)
533
+ if "show_in_menus" not in kwargs:
534
+ # if the value is not set on submit refer to the model setting
535
+ self.show_in_menus = self.show_in_menus_default
536
+
537
+ def __str__(self):
538
+ return self.title
539
+
540
+ @property
541
+ def revisions(self):
542
+ # Always use the specific page instance when querying for revisions as
543
+ # they are always saved with the specific content_type.
544
+ return self.specific_deferred._revisions
545
+
546
+ def get_base_content_type(self):
547
+ # We want to always use the default Page model's ContentType as the
548
+ # base_content_type so that we can query for page revisions without
549
+ # having to know the specific Page type.
550
+ return get_default_page_content_type()
551
+
552
+ def get_content_type(self):
553
+ return self.content_type
554
+
555
+ @classmethod
556
+ def get_streamfield_names(cls):
557
+ return get_streamfield_names(cls)
558
+
559
+ def set_url_path(self, parent):
560
+ """
561
+ Populate the url_path field based on this page's slug and the specified parent page.
562
+ (We pass a parent in here, rather than retrieving it via get_parent, so that we can give
563
+ new unsaved pages a meaningful URL when previewing them; at that point the page has not
564
+ been assigned a position in the tree, as far as treebeard is concerned.
565
+ """
566
+ if parent:
567
+ self.url_path = parent.url_path + self.slug + "/"
568
+ else:
569
+ # a page without a parent is the tree root, which always has a url_path of '/'
570
+ self.url_path = "/"
571
+
572
+ return self.url_path
573
+
574
+ @staticmethod
575
+ def _slug_is_available(slug, parent_page, page=None):
576
+ """
577
+ Determine whether the given slug is available for use on a child page of
578
+ parent_page. If 'page' is passed, the slug is intended for use on that page
579
+ (and so it will be excluded from the duplicate check).
580
+ """
581
+ if parent_page is None:
582
+ # the root page's slug can be whatever it likes...
583
+ return True
584
+
585
+ siblings = parent_page.get_children()
586
+ if page:
587
+ siblings = siblings.not_page(page)
588
+
589
+ return not siblings.filter(slug=slug).exists()
590
+
591
+ def _get_autogenerated_slug(self, base_slug):
592
+ candidate_slug = base_slug
593
+ suffix = 1
594
+ parent_page = self.get_parent()
595
+
596
+ while not Page._slug_is_available(candidate_slug, parent_page, self):
597
+ # try with incrementing suffix until we find a slug which is available
598
+ suffix += 1
599
+ candidate_slug = "%s-%d" % (base_slug, suffix)
600
+
601
+ return candidate_slug
602
+
603
+ def get_default_locale(self):
604
+ """
605
+ Finds the default locale to use for this page.
606
+
607
+ This will be called just before the initial save.
608
+ """
609
+ parent = self.get_parent()
610
+ if parent is not None:
611
+ return (
612
+ parent.specific_class.objects.defer()
613
+ .select_related("locale")
614
+ .get(id=parent.id)
615
+ .locale
616
+ )
617
+
618
+ return super().get_default_locale()
619
+
620
+ def get_admin_default_ordering(self):
621
+ """
622
+ Determine the default ordering for child pages in the admin index listing.
623
+ Returns a string (e.g. 'latest_revision_created_at, title, ord' or 'live').
624
+ """
625
+ return self.admin_default_ordering
626
+
627
+ def _set_core_field_defaults(self):
628
+ """
629
+ Set default values for core fields (slug, draft_title, locale) that need to be
630
+ in place before validating or saving
631
+ """
632
+ if not self.slug:
633
+ # Try to auto-populate slug from title
634
+ allow_unicode = getattr(settings, "WAGTAIL_ALLOW_UNICODE_SLUGS", True)
635
+ base_slug = slugify(self.title, allow_unicode=allow_unicode)
636
+
637
+ # only proceed if we get a non-empty base slug back from slugify
638
+ if base_slug:
639
+ self.slug = self._get_autogenerated_slug(base_slug)
640
+
641
+ if not self.draft_title:
642
+ self.draft_title = self.title
643
+
644
+ # Set the locale
645
+ if self.locale_id is None:
646
+ self.locale = self.get_default_locale()
647
+
648
+ def full_clean(self, *args, **kwargs):
649
+ self._set_core_field_defaults()
650
+ super().full_clean(*args, **kwargs)
651
+
652
+ def _check_slug_is_unique(self):
653
+ parent_page = self.get_parent()
654
+ if not Page._slug_is_available(self.slug, parent_page, self):
655
+ raise ValidationError(
656
+ {
657
+ "slug": _(
658
+ "The slug '%(page_slug)s' is already in use within the parent page at '%(parent_url_path)s'"
659
+ )
660
+ % {"page_slug": self.slug, "parent_url_path": parent_page.url}
661
+ }
662
+ )
663
+
664
+ def clean(self):
665
+ super().clean()
666
+ self._check_slug_is_unique()
667
+
668
+ def minimal_clean(self):
669
+ self._set_core_field_defaults()
670
+ self.title = self._meta.get_field("title").clean(self.title, self)
671
+ self._check_slug_is_unique()
672
+
673
+ def is_site_root(self):
674
+ """
675
+ Returns True if this page is the root of any site.
676
+
677
+ This includes translations of site root pages as well.
678
+ """
679
+ # `_is_site_root` may be populated by `annotate_site_root_state` on `PageQuerySet` as a
680
+ # performance optimisation
681
+ if hasattr(self, "_is_site_root"):
682
+ return self._is_site_root
683
+
684
+ return Site.objects.filter(
685
+ root_page__translation_key=self.translation_key
686
+ ).exists()
687
+
688
+ @transaction.atomic
689
+ # ensure that changes are only committed when we have updated all descendant URL paths, to preserve consistency
690
+ def save(self, clean=True, user=None, log_action=False, **kwargs):
691
+ """
692
+ Writes the page to the database, performing additional housekeeping tasks to ensure data
693
+ integrity:
694
+
695
+ * ``locale``, ``draft_title`` and ``slug`` are set to default values if not provided, with ``slug``
696
+ being generated from the title with a suffix to ensure uniqueness within the parent page
697
+ where necessary
698
+ * The ``url_path`` field is set based on the ``slug`` and the parent page
699
+ * If the ``slug`` has changed, the ``url_path`` of this page and all descendants is updated and
700
+ a :ref:`page_slug_changed` signal is sent
701
+
702
+ New pages should be saved by passing the unsaved page instance to the
703
+ :meth:`~treebeard.mp_tree.MP_Node.add_child`
704
+ or :meth:`~treebeard.mp_tree.MP_Node.add_sibling` method of an existing page, which will correctly update
705
+ the fields responsible for tracking the page's location in the tree.
706
+
707
+ If ``clean=False`` is passed, the page is saved without validation. This is appropriate for updates that only
708
+ change metadata such as `latest_revision` while keeping content and page location unchanged.
709
+
710
+ If ``clean=True`` is passed (the default), and the page has ``live=True`` set, the page is validated using
711
+ :meth:`~django.db.models.Model.full_clean` before saving.
712
+
713
+ If ``clean=True`` is passed, and the page has ``live=False`` set, only the title and slug fields are validated.
714
+
715
+ .. versionchanged:: 7.0
716
+ ``clean=True`` now only performs full validation when the page is live. When the page is not live, only
717
+ the title and slug fields are validated. Previously, full validation was always performed.
718
+ """
719
+ if clean:
720
+ if self.live:
721
+ self.full_clean()
722
+ else:
723
+ # Saving as draft; only perform the minimal validation to satisfy data integrity
724
+ self.minimal_clean()
725
+
726
+ slug_changed = False
727
+ is_new = self.id is None
728
+
729
+ if is_new:
730
+ # we are creating a record. If we're doing things properly, this should happen
731
+ # through a treebeard method like add_child, in which case the 'path' field
732
+ # has been set and so we can safely call get_parent
733
+ self.set_url_path(self.get_parent())
734
+ else:
735
+ # Check that we are committing the slug to the database
736
+ # Basically: If update_fields has been specified, and slug is not included, skip this step
737
+ if not (
738
+ "update_fields" in kwargs and "slug" not in kwargs["update_fields"]
739
+ ):
740
+ # see if the slug has changed from the record in the db, in which case we need to
741
+ # update url_path of self and all descendants. Even though we might not need it,
742
+ # the specific page is fetched here for sending to the 'page_slug_changed' signal.
743
+ old_record = Page.objects.get(id=self.id).specific
744
+ if old_record.slug != self.slug:
745
+ self.set_url_path(self.get_parent())
746
+ slug_changed = True
747
+ old_url_path = old_record.url_path
748
+ new_url_path = self.url_path
749
+
750
+ result = super().save(**kwargs)
751
+
752
+ if slug_changed:
753
+ self._update_descendant_url_paths(old_url_path, new_url_path)
754
+ # Emit page_slug_changed signal on successful db commit
755
+ transaction.on_commit(
756
+ lambda: page_slug_changed.send(
757
+ sender=self.specific_class or self.__class__,
758
+ instance=self.specific,
759
+ instance_before=old_record,
760
+ )
761
+ )
762
+
763
+ # Check if this is a root page of any sites and clear the 'wagtail_site_root_paths' key if so
764
+ # Note: New translations of existing site roots are considered site roots as well, so we must
765
+ # always check if this page is a site root, even if it's new.
766
+ if self.is_site_root():
767
+ Site.clear_site_root_paths_cache()
768
+
769
+ # Log
770
+ if is_new:
771
+ cls = type(self)
772
+ logger.info(
773
+ 'Page created: "%s" id=%d content_type=%s.%s path=%s',
774
+ self.title,
775
+ self.id,
776
+ cls._meta.app_label,
777
+ cls.__name__,
778
+ self.url_path,
779
+ )
780
+
781
+ if log_action is not None:
782
+ # The default for log_action is False. i.e. don't log unless specifically instructed
783
+ # Page creation is a special case that we want logged by default, but allow skipping it
784
+ # explicitly by passing log_action=None
785
+ if is_new:
786
+ log(
787
+ instance=self,
788
+ action="wagtail.create",
789
+ user=user or self.owner,
790
+ content_changed=True,
791
+ )
792
+ elif log_action:
793
+ log(instance=self, action=log_action, user=user)
794
+
795
+ return result
796
+
797
+ def delete(self, *args, **kwargs):
798
+ user = kwargs.pop("user", None)
799
+ return DeletePageAction(self, user=user).execute(*args, **kwargs)
800
+
801
+ @classmethod
802
+ def check(cls, **kwargs):
803
+ errors = super().check(**kwargs)
804
+
805
+ # Check that foreign keys from pages are not configured to cascade
806
+ # This is the default Django behaviour which must be explicitly overridden
807
+ # to prevent pages disappearing unexpectedly and the tree being corrupted
808
+
809
+ # get names of foreign keys pointing to parent classes (such as page_ptr)
810
+ field_exceptions = [
811
+ field.name
812
+ for model in [cls] + list(cls._meta.get_parent_list())
813
+ for field in model._meta.parents.values()
814
+ if field
815
+ ]
816
+
817
+ for field in cls._meta.fields:
818
+ if (
819
+ isinstance(field, models.ForeignKey)
820
+ and field.name not in field_exceptions
821
+ ):
822
+ if field.remote_field.on_delete == models.CASCADE:
823
+ errors.append(
824
+ checks.Warning(
825
+ "Field hasn't specified on_delete action",
826
+ hint="Set on_delete=models.SET_NULL and make sure the field is nullable or set on_delete=models.PROTECT. Wagtail does not allow simple database CASCADE because it will corrupt its tree storage.",
827
+ obj=field,
828
+ id="wagtailcore.W001",
829
+ )
830
+ )
831
+
832
+ if not isinstance(cls.objects, PageManager):
833
+ errors.append(
834
+ checks.Error(
835
+ "Manager does not inherit from PageManager",
836
+ hint="Ensure that custom Page managers inherit from wagtail.models.PageManager",
837
+ obj=cls,
838
+ id="wagtailcore.E002",
839
+ )
840
+ )
841
+
842
+ try:
843
+ cls.clean_subpage_models()
844
+ except (ValueError, LookupError) as e:
845
+ errors.append(
846
+ checks.Error(
847
+ "Invalid subpage_types setting for %s" % cls,
848
+ hint=str(e),
849
+ id="wagtailcore.E002",
850
+ )
851
+ )
852
+
853
+ try:
854
+ cls.clean_parent_page_models()
855
+ except (ValueError, LookupError) as e:
856
+ errors.append(
857
+ checks.Error(
858
+ "Invalid parent_page_types setting for %s" % cls,
859
+ hint=str(e),
860
+ id="wagtailcore.E002",
861
+ )
862
+ )
863
+
864
+ return errors
865
+
866
+ def _update_descendant_url_paths(self, old_url_path, new_url_path):
867
+ (
868
+ Page.objects.filter(path__startswith=self.path)
869
+ .exclude(pk=self.pk)
870
+ .update(
871
+ url_path=Concat(
872
+ Value(new_url_path), Substr("url_path", len(old_url_path) + 1)
873
+ )
874
+ )
875
+ )
876
+
877
+ @property
878
+ def page_type_display_name(self):
879
+ """
880
+ A human-readable version of this page's type.
881
+ """
882
+ if not self.specific_class or self.is_root():
883
+ return ""
884
+ else:
885
+ return self.specific_class.get_verbose_name()
886
+
887
+ def route(self, request, path_components):
888
+ if path_components:
889
+ # request is for a child of this page
890
+ child_slug = path_components[0]
891
+ remaining_components = path_components[1:]
892
+
893
+ try:
894
+ subpage = self.get_children().get(slug=child_slug)
895
+ # Cache the parent page on the subpage to avoid another db query
896
+ # Treebeard's get_parent will use the `_cached_parent_obj` attribute if it exists
897
+ # And update = False
898
+ setattr(subpage, "_cached_parent_obj", self)
899
+
900
+ except Page.DoesNotExist:
901
+ raise Http404
902
+
903
+ return subpage.specific.route(request, remaining_components)
904
+
905
+ else:
906
+ # request is for this very page
907
+ if self.live:
908
+ return RouteResult(self)
909
+ else:
910
+ raise Http404
911
+
912
+ def get_admin_display_title(self):
913
+ """
914
+ Return the title for this page as it should appear in the admin backend;
915
+ override this if you wish to display extra contextual information about the page,
916
+ such as language. By default, returns ``draft_title``.
917
+ """
918
+ # Fall back on title if draft_title is blank (which may happen if the page was created
919
+ # in a fixture or migration that didn't explicitly handle draft_title)
920
+ return self.draft_title or self.title
921
+
922
+ def save_revision(
923
+ self,
924
+ user=None,
925
+ approved_go_live_at=None,
926
+ changed=True,
927
+ log_action=False,
928
+ previous_revision=None,
929
+ clean=True,
930
+ ):
931
+ # Raise error if this is not the specific version of the page
932
+ if not isinstance(self, self.specific_class):
933
+ raise RuntimeError(
934
+ "page.save_revision() must be called on the specific version of the page. "
935
+ "Call page.specific.save_revision() instead."
936
+ )
937
+
938
+ # Raise an error if this page is an alias.
939
+ if self.alias_of_id:
940
+ raise RuntimeError(
941
+ "page.save_revision() was called on an alias page. "
942
+ "Revisions are not required for alias pages as they are an exact copy of another page."
943
+ )
944
+
945
+ if clean:
946
+ self.full_clean()
947
+
948
+ new_comments = getattr(self, COMMENTS_RELATION_NAME).filter(pk__isnull=True)
949
+ for comment in new_comments:
950
+ # We need to ensure comments have an id in the revision, so positions can be identified correctly
951
+ comment.save()
952
+
953
+ revision = Revision.objects.create(
954
+ content_object=self,
955
+ base_content_type=self.get_base_content_type(),
956
+ user=user,
957
+ approved_go_live_at=approved_go_live_at,
958
+ content=self.serializable_data(),
959
+ object_str=str(self),
960
+ )
961
+
962
+ for comment in new_comments:
963
+ comment.revision_created = revision
964
+
965
+ self.latest_revision_created_at = revision.created_at
966
+ self.draft_title = self.title
967
+ self.latest_revision = revision
968
+
969
+ update_fields = [
970
+ COMMENTS_RELATION_NAME,
971
+ "latest_revision_created_at",
972
+ "draft_title",
973
+ "latest_revision",
974
+ ]
975
+
976
+ if changed:
977
+ self.has_unpublished_changes = True
978
+ update_fields.append("has_unpublished_changes")
979
+
980
+ if update_fields:
981
+ # clean=False because the fields we're updating don't need validation
982
+ self.save(update_fields=update_fields, clean=False)
983
+
984
+ # Log
985
+ logger.info(
986
+ 'Page edited: "%s" id=%d revision_id=%d', self.title, self.id, revision.id
987
+ )
988
+ if log_action:
989
+ if not previous_revision:
990
+ log(
991
+ instance=self,
992
+ action=log_action
993
+ if isinstance(log_action, str)
994
+ else "wagtail.edit",
995
+ user=user,
996
+ revision=revision,
997
+ content_changed=changed,
998
+ )
999
+ else:
1000
+ log(
1001
+ instance=self,
1002
+ action=log_action
1003
+ if isinstance(log_action, str)
1004
+ else "wagtail.revert",
1005
+ user=user,
1006
+ data={
1007
+ "revision": {
1008
+ "id": previous_revision.id,
1009
+ "created": ensure_utc(previous_revision.created_at),
1010
+ }
1011
+ },
1012
+ revision=revision,
1013
+ content_changed=changed,
1014
+ )
1015
+
1016
+ return revision
1017
+
1018
+ def get_latest_revision_as_object(self):
1019
+ if not self.has_unpublished_changes:
1020
+ # Use the live database copy in preference to the revision record, as:
1021
+ # 1) this will pick up any changes that have been made directly to the model,
1022
+ # such as automated data imports;
1023
+ # 2) it ensures that inline child objects pick up real database IDs even if
1024
+ # those are absent from the revision data. (If this wasn't the case, the child
1025
+ # objects would be recreated with new IDs on next publish - see #1853)
1026
+ return self.specific
1027
+
1028
+ latest_revision = self.get_latest_revision()
1029
+
1030
+ if latest_revision:
1031
+ return latest_revision.as_object()
1032
+ else:
1033
+ return self.specific
1034
+
1035
+ def update_aliases(self, *, revision=None, _content=None, _updated_ids=None):
1036
+ """
1037
+ Publishes all aliases that follow this page with the latest content from this page.
1038
+
1039
+ This is called by Wagtail whenever a page with aliases is published.
1040
+
1041
+ :param revision: The revision of the original page that we are updating to (used for logging purposes)
1042
+ :type revision: Revision, Optional
1043
+ """
1044
+ specific_self = self.specific
1045
+
1046
+ # Only compute this if necessary since it's quite a heavy operation
1047
+ if _content is None:
1048
+ _content = self.serializable_data()
1049
+
1050
+ # A list of IDs that have already been updated. This is just in case someone has
1051
+ # created an alias loop (which is impossible to do with the UI Wagtail provides)
1052
+ _updated_ids = _updated_ids or []
1053
+
1054
+ for alias in self.specific_class.objects.filter(alias_of=self).exclude(
1055
+ id__in=_updated_ids
1056
+ ):
1057
+ # FIXME: Switch to the same fields that are excluded from copy
1058
+ # We can't do this right now because we can't exclude fields from with_content_json
1059
+ exclude_fields = [
1060
+ "id",
1061
+ "path",
1062
+ "depth",
1063
+ "numchild",
1064
+ "url_path",
1065
+ "path",
1066
+ "index_entries",
1067
+ "postgres_index_entries",
1068
+ ]
1069
+
1070
+ # Copy field content
1071
+ alias_updated = alias.with_content_json(_content)
1072
+
1073
+ # Publish the alias if it's currently in draft
1074
+ alias_updated.live = True
1075
+ alias_updated.has_unpublished_changes = False
1076
+
1077
+ # Copy child relations
1078
+ child_object_map = specific_self.copy_all_child_relations(
1079
+ target=alias_updated, exclude=exclude_fields
1080
+ )
1081
+
1082
+ # Process child objects
1083
+ # This has two jobs:
1084
+ # - If the alias is in a different locale, this updates the
1085
+ # locale of any translatable child objects to match
1086
+ # - If the alias is not a translation of the original, this
1087
+ # changes the translation_key field of all child objects
1088
+ # so they do not clash
1089
+ if child_object_map:
1090
+ alias_is_translation = alias.translation_key == self.translation_key
1091
+
1092
+ def process_child_object(child_object):
1093
+ if isinstance(child_object, TranslatableMixin):
1094
+ # Child object's locale must always match the page
1095
+ child_object.locale = alias_updated.locale
1096
+
1097
+ # If the alias isn't a translation of the original page,
1098
+ # change the child object's translation_keys so they are
1099
+ # not either
1100
+ if not alias_is_translation:
1101
+ child_object.translation_key = uuid.uuid4()
1102
+
1103
+ for (rel, previous_id), child_objects in child_object_map.items():
1104
+ if previous_id is None:
1105
+ for child_object in child_objects:
1106
+ process_child_object(child_object)
1107
+ else:
1108
+ process_child_object(child_objects)
1109
+
1110
+ # Copy M2M relations
1111
+ _copy_m2m_relations(
1112
+ specific_self, alias_updated, exclude_fields=exclude_fields
1113
+ )
1114
+
1115
+ # Don't change the aliases slug
1116
+ # Aliases can have their own slugs so they can be siblings of the original
1117
+ alias_updated.slug = alias.slug
1118
+ alias_updated.set_url_path(alias_updated.get_parent())
1119
+
1120
+ # Aliases don't have revisions, so update fields that would normally be updated by save_revision
1121
+ alias_updated.draft_title = alias_updated.title
1122
+ alias_updated.latest_revision_created_at = self.latest_revision_created_at
1123
+
1124
+ alias_updated.save(clean=False)
1125
+
1126
+ page_published.send(
1127
+ sender=alias_updated.specific_class,
1128
+ instance=alias_updated,
1129
+ revision=revision,
1130
+ alias=True,
1131
+ )
1132
+
1133
+ # Update any aliases of that alias
1134
+
1135
+ # Design note:
1136
+ # It could be argued that this will be faster if we just changed these alias-of-alias
1137
+ # pages to all point to the original page and avoid having to update them recursively.
1138
+ #
1139
+ # But, it's useful to have a record of how aliases have been chained.
1140
+ # For example, In Wagtail Localize, we use aliases to create mirrored trees, but those
1141
+ # trees themselves could have aliases within them. If an alias within a tree is
1142
+ # converted to a regular page, we want the alias in the mirrored tree to follow that
1143
+ # new page and stop receiving updates from the original page.
1144
+ #
1145
+ # Doing it this way requires an extra lookup query per alias but this is small in
1146
+ # comparison to the work required to update the alias.
1147
+
1148
+ alias.update_aliases(
1149
+ revision=revision,
1150
+ _content=_content,
1151
+ _updated_ids=_updated_ids,
1152
+ )
1153
+
1154
+ update_aliases.alters_data = True
1155
+
1156
+ def publish(
1157
+ self,
1158
+ revision,
1159
+ user=None,
1160
+ changed=True,
1161
+ log_action=True,
1162
+ previous_revision=None,
1163
+ skip_permission_checks=False,
1164
+ ):
1165
+ return PublishPageRevisionAction(
1166
+ revision,
1167
+ user=user,
1168
+ changed=changed,
1169
+ log_action=log_action,
1170
+ previous_revision=previous_revision,
1171
+ ).execute(skip_permission_checks=skip_permission_checks)
1172
+
1173
+ def unpublish(self, set_expired=False, commit=True, user=None, log_action=True):
1174
+ return UnpublishPageAction(
1175
+ self,
1176
+ set_expired=set_expired,
1177
+ commit=commit,
1178
+ user=user,
1179
+ log_action=log_action,
1180
+ ).execute()
1181
+
1182
+ context_object_name = None
1183
+
1184
+ def get_context(self, request, *args, **kwargs):
1185
+ context = {
1186
+ PAGE_TEMPLATE_VAR: self,
1187
+ "self": self,
1188
+ "request": request,
1189
+ }
1190
+
1191
+ if self.context_object_name:
1192
+ context[self.context_object_name] = self
1193
+
1194
+ return context
1195
+
1196
+ def get_preview_context(self, request, mode_name):
1197
+ return self.get_context(request)
1198
+
1199
+ def get_template(self, request, *args, **kwargs):
1200
+ if request.headers.get("x-requested-with") == "XMLHttpRequest":
1201
+ return self.ajax_template or self.template
1202
+ else:
1203
+ return self.template
1204
+
1205
+ def get_preview_template(self, request, mode_name):
1206
+ return self.get_template(request)
1207
+
1208
+ def serve(self, request, *args, **kwargs):
1209
+ request.is_preview = False
1210
+
1211
+ return TemplateResponse(
1212
+ request,
1213
+ self.get_template(request, *args, **kwargs),
1214
+ self.get_context(request, *args, **kwargs),
1215
+ )
1216
+
1217
+ def check_request_method(self, request, *args, **kwargs):
1218
+ """
1219
+ Checks the ``method`` attribute of the request against those supported
1220
+ by the page (as defined by :attr:`allowed_http_methods`) and responds
1221
+ accordingly.
1222
+
1223
+ If supported, ``None`` is returned, and the request is processed
1224
+ normally. If not, a warning is logged and an ``HttpResponseNotAllowed``
1225
+ is returned, and any further request handling is terminated.
1226
+ """
1227
+ allowed_methods = self.allowed_http_method_names()
1228
+ if request.method not in allowed_methods:
1229
+ logger.warning(
1230
+ "Method Not Allowed (%s): %s",
1231
+ request.method,
1232
+ request.path,
1233
+ extra={"status_code": 405, "request": request},
1234
+ )
1235
+ return HttpResponseNotAllowed(allowed_methods)
1236
+
1237
+ def handle_options_request(self, request, *args, **kwargs):
1238
+ """
1239
+ Returns an ``HttpResponse`` with an ``"Allow"`` header containing the list of
1240
+ supported HTTP methods for this page. This method is used instead of
1241
+ :meth:`serve` to handle requests when the ``OPTIONS`` HTTP verb is
1242
+ detected (and :class:`HTTPMethod.OPTIONS <python:http.HTTPMethod>` is
1243
+ present in :attr:`allowed_http_methods` for this type of page).
1244
+ """
1245
+ return HttpResponse(
1246
+ headers={"Allow": ", ".join(self.allowed_http_method_names())}
1247
+ )
1248
+
1249
+ def is_navigable(self):
1250
+ """
1251
+ Return true if it's meaningful to browse subpages of this page -
1252
+ i.e. it currently has subpages,
1253
+ or it's at the top level (this rule necessary for empty out-of-the-box sites to have working navigation)
1254
+ """
1255
+ return (not self.is_leaf()) or self.depth == 2
1256
+
1257
+ def _get_site_root_paths(self, request=None):
1258
+ """
1259
+ Return ``Site.get_site_root_paths()``, using the cached copy on the
1260
+ request object if available.
1261
+ """
1262
+ # if we have a request, use that to cache site_root_paths; otherwise, use self
1263
+ cache_object = request if request else self
1264
+ try:
1265
+ return cache_object._wagtail_cached_site_root_paths
1266
+ except AttributeError:
1267
+ cache_object._wagtail_cached_site_root_paths = Site.get_site_root_paths()
1268
+ return cache_object._wagtail_cached_site_root_paths
1269
+
1270
+ def _get_relevant_site_root_paths(self, cache_object=None):
1271
+ """
1272
+ Returns a tuple of root paths for all sites this page belongs to.
1273
+ """
1274
+ return tuple(
1275
+ srp
1276
+ for srp in self._get_site_root_paths(cache_object)
1277
+ if self.url_path.startswith(srp.root_path)
1278
+ )
1279
+
1280
+ def get_url_parts(self, request=None):
1281
+ """
1282
+ Determine the URL for this page and return it as a tuple of
1283
+ ``(site_id, site_root_url, page_url_relative_to_site_root)``.
1284
+ Return ``None`` if the page is not routable, or return
1285
+ ``(site_id, None, None)`` if ``NoReverseMatch`` exception is raised.
1286
+
1287
+ This is used internally by the ``full_url``, ``url``, ``relative_url``
1288
+ and ``get_site`` properties and methods; pages with custom URL routing
1289
+ should override this method in order to have those operations return
1290
+ the custom URLs.
1291
+
1292
+ Accepts an optional keyword argument ``request``, which may be used
1293
+ to avoid repeated database / cache lookups. Typically, a page model
1294
+ that overrides ``get_url_parts`` should not need to deal with
1295
+ ``request`` directly, and should just pass it to the original method
1296
+ when calling ``super``.
1297
+ """
1298
+
1299
+ possible_sites = self._get_relevant_site_root_paths(request)
1300
+
1301
+ if not possible_sites:
1302
+ return None
1303
+
1304
+ # Thanks to the ordering applied by Site.get_site_root_paths(),
1305
+ # the first item is ideal in the vast majority of setups.
1306
+ site_id, root_path, root_url, language_code = possible_sites[0]
1307
+
1308
+ unique_site_ids = {values[0] for values in possible_sites}
1309
+ if len(unique_site_ids) > 1 and isinstance(request, HttpRequest):
1310
+ # The page somehow belongs to more than one site (rare, but possible).
1311
+ # If 'request' is indeed a HttpRequest, use it to identify the 'current'
1312
+ # site and prefer an option matching that (where present).
1313
+ site = Site.find_for_request(request)
1314
+ if site:
1315
+ for values in possible_sites:
1316
+ if values[0] == site.pk:
1317
+ site_id, root_path, root_url, language_code = values
1318
+ break
1319
+
1320
+ use_wagtail_i18n = getattr(settings, "WAGTAIL_I18N_ENABLED", False)
1321
+
1322
+ if use_wagtail_i18n:
1323
+ # If the active language code is a variant of the page's language, then
1324
+ # use that instead
1325
+ # This is used when LANGUAGES contain more languages than WAGTAIL_CONTENT_LANGUAGES
1326
+ try:
1327
+ if (
1328
+ get_supported_content_language_variant(translation.get_language())
1329
+ == language_code
1330
+ ):
1331
+ language_code = translation.get_language()
1332
+ except LookupError:
1333
+ # active language code is not a recognised content language, so leave
1334
+ # page's language code unchanged
1335
+ pass
1336
+
1337
+ # The page may not be routable because wagtail_serve is not registered
1338
+ # This may be the case if Wagtail is used headless
1339
+ try:
1340
+ if use_wagtail_i18n:
1341
+ with translation.override(language_code):
1342
+ page_path = reverse(
1343
+ "wagtail_serve", args=(self.url_path[len(root_path) :],)
1344
+ )
1345
+ else:
1346
+ page_path = reverse(
1347
+ "wagtail_serve", args=(self.url_path[len(root_path) :],)
1348
+ )
1349
+ except NoReverseMatch:
1350
+ return (site_id, None, None)
1351
+
1352
+ # Remove the trailing slash from the URL reverse generates if
1353
+ # WAGTAIL_APPEND_SLASH is False and we're not trying to serve
1354
+ # the root path
1355
+ if not WAGTAIL_APPEND_SLASH and page_path != "/":
1356
+ page_path = page_path.rstrip("/")
1357
+
1358
+ return (site_id, root_url, page_path)
1359
+
1360
+ def get_full_url(self, request=None):
1361
+ """
1362
+ Return the full URL (including protocol / domain) to this page, or ``None`` if it is not routable.
1363
+ """
1364
+ url_parts = self.get_url_parts(request=request)
1365
+
1366
+ if url_parts is None or url_parts[1] is None and url_parts[2] is None:
1367
+ # page is not routable
1368
+ return
1369
+
1370
+ site_id, root_url, page_path = url_parts
1371
+
1372
+ return root_url + page_path
1373
+
1374
+ full_url = property(get_full_url)
1375
+
1376
+ def get_url(self, request=None, current_site=None):
1377
+ """
1378
+ Return the 'most appropriate' URL for referring to this page from the pages we serve,
1379
+ within the Wagtail backend and actual website templates;
1380
+ this is the local URL (starting with '/') if we're only running a single site
1381
+ (i.e. we know that whatever the current page is being served from, this link will be on the
1382
+ same domain), and the full URL (with domain) if not.
1383
+ Return ``None`` if the page is not routable.
1384
+
1385
+ Accepts an optional but recommended ``request`` keyword argument that, if provided, will
1386
+ be used to cache site-level URL information (thereby avoiding repeated database / cache
1387
+ lookups) and, via the ``Site.find_for_request()`` function, determine whether a relative
1388
+ or full URL is most appropriate.
1389
+ """
1390
+ # ``current_site`` is purposefully undocumented, as one can simply pass the request and get
1391
+ # a relative URL based on ``Site.find_for_request()``. Nonetheless, support it here to avoid
1392
+ # copy/pasting the code to the ``relative_url`` method below.
1393
+ if current_site is None and request is not None:
1394
+ site = Site.find_for_request(request)
1395
+ current_site = site
1396
+ url_parts = self.get_url_parts(request=request)
1397
+
1398
+ if url_parts is None or url_parts[1] is None and url_parts[2] is None:
1399
+ # page is not routable
1400
+ return
1401
+
1402
+ site_id, root_url, page_path = url_parts
1403
+
1404
+ # Get number of unique sites in root paths
1405
+ # Note: there may be more root paths to sites if there are multiple languages
1406
+ num_sites = len(
1407
+ {root_path[0] for root_path in self._get_site_root_paths(request)}
1408
+ )
1409
+
1410
+ if (current_site is not None and site_id == current_site.id) or num_sites == 1:
1411
+ # the site matches OR we're only running a single site, so a local URL is sufficient
1412
+ return page_path
1413
+ else:
1414
+ return root_url + page_path
1415
+
1416
+ url = property(get_url)
1417
+
1418
+ def relative_url(self, current_site, request=None):
1419
+ """
1420
+ Return the 'most appropriate' URL for this page taking into account the site we're currently on;
1421
+ a local URL if the site matches, or a fully qualified one otherwise.
1422
+ Return ``None`` if the page is not routable.
1423
+
1424
+ Accepts an optional but recommended ``request`` keyword argument that, if provided, will
1425
+ be used to cache site-level URL information (thereby avoiding repeated database / cache
1426
+ lookups).
1427
+ """
1428
+ return self.get_url(request=request, current_site=current_site)
1429
+
1430
+ def get_site(self):
1431
+ """
1432
+ Return the Site object that this page belongs to.
1433
+ """
1434
+
1435
+ url_parts = self.get_url_parts()
1436
+
1437
+ if url_parts is None:
1438
+ # page is not routable
1439
+ return
1440
+
1441
+ site_id, root_url, page_path = url_parts
1442
+
1443
+ return Site.objects.get(id=site_id)
1444
+
1445
+ @classmethod
1446
+ def get_indexed_objects(cls):
1447
+ content_type = ContentType.objects.get_for_model(cls)
1448
+ return super().get_indexed_objects().filter(content_type=content_type)
1449
+
1450
+ def get_indexed_instance(self):
1451
+ # This is accessed on save by the wagtailsearch signal handler, and in edge
1452
+ # cases (e.g. loading test fixtures), may be called before the specific instance's
1453
+ # entry has been created. In those cases, we aren't ready to be indexed yet, so
1454
+ # return None.
1455
+ try:
1456
+ return self.specific
1457
+ except self.specific_class.DoesNotExist:
1458
+ return None
1459
+
1460
+ def get_default_privacy_setting(self, request: HttpRequest):
1461
+ """Set the default privacy setting for a page."""
1462
+ return {"type": BaseViewRestriction.NONE}
1463
+
1464
+ @classmethod
1465
+ def clean_subpage_models(cls):
1466
+ """
1467
+ Returns the list of subpage types, normalized as model classes.
1468
+ Throws ValueError if any entry in subpage_types cannot be recognized as a model name,
1469
+ or LookupError if a model does not exist (or is not a Page subclass).
1470
+ """
1471
+ if cls._clean_subpage_models is None:
1472
+ subpage_types = getattr(cls, "subpage_types", None)
1473
+ if subpage_types is None:
1474
+ # if subpage_types is not specified on the Page class, allow all page types as subpages
1475
+ cls._clean_subpage_models = get_page_models()
1476
+ else:
1477
+ cls._clean_subpage_models = [
1478
+ resolve_model_string(model_string, cls._meta.app_label)
1479
+ for model_string in subpage_types
1480
+ ]
1481
+
1482
+ for model in cls._clean_subpage_models:
1483
+ if not issubclass(model, Page):
1484
+ raise LookupError("%s is not a Page subclass" % model)
1485
+
1486
+ return cls._clean_subpage_models
1487
+
1488
+ @classmethod
1489
+ def clean_parent_page_models(cls):
1490
+ """
1491
+ Returns the list of parent page types, normalized as model classes.
1492
+ Throws ValueError if any entry in parent_page_types cannot be recognized as a model name,
1493
+ or LookupError if a model does not exist (or is not a Page subclass).
1494
+ """
1495
+
1496
+ if cls._clean_parent_page_models is None:
1497
+ parent_page_types = getattr(cls, "parent_page_types", None)
1498
+ if parent_page_types is None:
1499
+ # if parent_page_types is not specified on the Page class, allow all page types as subpages
1500
+ cls._clean_parent_page_models = get_page_models()
1501
+ else:
1502
+ cls._clean_parent_page_models = [
1503
+ resolve_model_string(model_string, cls._meta.app_label)
1504
+ for model_string in parent_page_types
1505
+ ]
1506
+
1507
+ for model in cls._clean_parent_page_models:
1508
+ if not issubclass(model, Page):
1509
+ raise LookupError("%s is not a Page subclass" % model)
1510
+
1511
+ return cls._clean_parent_page_models
1512
+
1513
+ @classmethod
1514
+ def allowed_parent_page_models(cls):
1515
+ """
1516
+ Returns the list of page types that this page type can be a subpage of,
1517
+ as a list of model classes.
1518
+ """
1519
+ return [
1520
+ parent_model
1521
+ for parent_model in cls.clean_parent_page_models()
1522
+ if cls in parent_model.clean_subpage_models()
1523
+ ]
1524
+
1525
+ @classmethod
1526
+ def allowed_subpage_models(cls):
1527
+ """
1528
+ Returns the list of page types that this page type can have as subpages,
1529
+ as a list of model classes.
1530
+ """
1531
+ return [
1532
+ subpage_model
1533
+ for subpage_model in cls.clean_subpage_models()
1534
+ if cls in subpage_model.clean_parent_page_models()
1535
+ ]
1536
+
1537
+ @classmethod
1538
+ def creatable_subpage_models(cls):
1539
+ """
1540
+ Returns the list of page types that may be created under this page type,
1541
+ as a list of model classes.
1542
+ """
1543
+ return [
1544
+ page_model
1545
+ for page_model in cls.allowed_subpage_models()
1546
+ if page_model.is_creatable
1547
+ ]
1548
+
1549
+ @classmethod
1550
+ def can_exist_under(cls, parent):
1551
+ """
1552
+ Checks if this page type can exist as a subpage under a parent page
1553
+ instance.
1554
+
1555
+ See also: :func:`Page.can_create_at` and :func:`Page.can_move_to`
1556
+ """
1557
+ return cls in parent.specific_class.allowed_subpage_models()
1558
+
1559
+ @classmethod
1560
+ def can_create_at(cls, parent):
1561
+ """
1562
+ Checks if this page type can be created as a subpage under a parent
1563
+ page instance.
1564
+ """
1565
+ can_create = cls.is_creatable and cls.can_exist_under(parent)
1566
+
1567
+ if cls.max_count is not None:
1568
+ can_create = can_create and cls.objects.count() < cls.max_count
1569
+
1570
+ if cls.max_count_per_parent is not None:
1571
+ can_create = (
1572
+ can_create
1573
+ and parent.get_children().type(cls).count() < cls.max_count_per_parent
1574
+ )
1575
+
1576
+ return can_create
1577
+
1578
+ def can_move_to(self, parent):
1579
+ """
1580
+ Checks if this page instance can be moved to be a subpage of a parent
1581
+ page instance.
1582
+ """
1583
+ # Prevent pages from being moved to different language sections
1584
+ # The only page that can have multi-lingual children is the root page
1585
+ parent_is_root = parent.depth == 1
1586
+ if not parent_is_root and parent.locale_id != self.locale_id:
1587
+ return False
1588
+
1589
+ return self.can_exist_under(parent)
1590
+
1591
+ @classmethod
1592
+ def get_verbose_name(cls):
1593
+ """
1594
+ Returns the human-readable "verbose name" of this page model e.g "Blog page".
1595
+ """
1596
+ # This is similar to doing cls._meta.verbose_name.title()
1597
+ # except this doesn't convert any characters to lowercase
1598
+ return capfirst(cls._meta.verbose_name)
1599
+
1600
+ @classmethod
1601
+ def get_page_description(cls):
1602
+ """
1603
+ Returns a page description if it's set. For example "A multi-purpose web page".
1604
+ """
1605
+ description = getattr(cls, "page_description", None)
1606
+
1607
+ # make sure that page_description is actually a string rather than a model field
1608
+ if isinstance(description, str):
1609
+ return description
1610
+ elif isinstance(description, Promise):
1611
+ # description is a lazy object (e.g. the result of gettext_lazy())
1612
+ return str(description)
1613
+ else:
1614
+ return ""
1615
+
1616
+ @property
1617
+ def approved_schedule(self):
1618
+ """
1619
+ ``_approved_schedule`` may be populated by ``annotate_approved_schedule`` on ``PageQuerySet`` as a
1620
+ performance optimization.
1621
+ """
1622
+ if hasattr(self, "_approved_schedule"):
1623
+ return self._approved_schedule
1624
+
1625
+ return self.scheduled_revision is not None
1626
+
1627
+ def has_unpublished_subtree(self):
1628
+ """
1629
+ An awkwardly-defined flag used in determining whether unprivileged editors have
1630
+ permission to delete this article. Returns true if and only if this page is non-live,
1631
+ and it has no live children.
1632
+ """
1633
+ return (not self.live) and (
1634
+ not self.get_descendants().filter(live=True).exists()
1635
+ )
1636
+
1637
+ def move(self, target, pos=None, user=None):
1638
+ """
1639
+ Extension to the treebeard 'move' method to ensure that url_path is updated,
1640
+ and to emit a 'pre_page_move' and 'post_page_move' signals.
1641
+ """
1642
+ return MovePageAction(self, target, pos=pos, user=user).execute()
1643
+
1644
+ def copy(
1645
+ self,
1646
+ recursive=False,
1647
+ to=None,
1648
+ update_attrs=None,
1649
+ copy_revisions=True,
1650
+ keep_live=True,
1651
+ user=None,
1652
+ process_child_object=None,
1653
+ exclude_fields=None,
1654
+ log_action="wagtail.copy",
1655
+ reset_translation_key=True,
1656
+ ):
1657
+ """
1658
+ Copies a given page
1659
+
1660
+ :param log_action: flag for logging the action. Pass None to skip logging. Can be passed an action string. Defaults to ``'wagtail.copy'``.
1661
+ """
1662
+ return CopyPageAction(
1663
+ self,
1664
+ to=to,
1665
+ update_attrs=update_attrs,
1666
+ exclude_fields=exclude_fields,
1667
+ recursive=recursive,
1668
+ copy_revisions=copy_revisions,
1669
+ keep_live=keep_live,
1670
+ user=user,
1671
+ process_child_object=process_child_object,
1672
+ log_action=log_action,
1673
+ reset_translation_key=reset_translation_key,
1674
+ ).execute(skip_permission_checks=True)
1675
+
1676
+ copy.alters_data = True
1677
+
1678
+ def create_alias(
1679
+ self,
1680
+ *,
1681
+ recursive=False,
1682
+ parent=None,
1683
+ update_slug=None,
1684
+ update_locale=None,
1685
+ user=None,
1686
+ log_action="wagtail.create_alias",
1687
+ reset_translation_key=True,
1688
+ _mpnode_attrs=None,
1689
+ ):
1690
+ return CreatePageAliasAction(
1691
+ self,
1692
+ recursive=recursive,
1693
+ parent=parent,
1694
+ update_slug=update_slug,
1695
+ update_locale=update_locale,
1696
+ user=user,
1697
+ log_action=log_action,
1698
+ reset_translation_key=reset_translation_key,
1699
+ _mpnode_attrs=_mpnode_attrs,
1700
+ ).execute()
1701
+
1702
+ create_alias.alters_data = True
1703
+
1704
+ def copy_for_translation(
1705
+ self, locale, copy_parents=False, alias=False, exclude_fields=None
1706
+ ):
1707
+ """Creates a copy of this page in the specified locale."""
1708
+
1709
+ return CopyPageForTranslationAction(
1710
+ self,
1711
+ locale,
1712
+ copy_parents=copy_parents,
1713
+ alias=alias,
1714
+ exclude_fields=exclude_fields,
1715
+ ).execute()
1716
+
1717
+ copy_for_translation.alters_data = True
1718
+
1719
+ def permissions_for_user(self, user):
1720
+ """
1721
+ Return a PagePermissionsTester object defining what actions the user can perform on this page.
1722
+ """
1723
+ # Allow specific classes to override this method, but only cast to the
1724
+ # specific instance if it's not already specific and if the method has
1725
+ # been overridden. This helps improve performance when working with
1726
+ # base Page querysets.
1727
+ is_overridden = (
1728
+ self.specific_class
1729
+ and self.specific_class.permissions_for_user
1730
+ != type(self).permissions_for_user
1731
+ )
1732
+ if is_overridden and not isinstance(self, self.specific_class):
1733
+ return self.specific_deferred.permissions_for_user(user)
1734
+ return PagePermissionTester(user, self)
1735
+
1736
+ def is_previewable(self):
1737
+ """Returns True if at least one preview mode is specified"""
1738
+ # It's possible that this will be called from a listing page using a plain Page queryset -
1739
+ # if so, checking self.preview_modes would incorrectly give us the default set from
1740
+ # Page.preview_modes. However, accessing self.specific.preview_modes would result in an N+1
1741
+ # query problem. To avoid this (at least in the general case), we'll call .specific only if
1742
+ # a check of the property at the class level indicates that preview_modes has been
1743
+ # overridden from whatever type we're currently in.
1744
+ page = self
1745
+ if page.specific_class.preview_modes != type(page).preview_modes:
1746
+ page = page.specific
1747
+
1748
+ return bool(page.preview_modes)
1749
+
1750
+ def get_route_paths(self):
1751
+ """
1752
+ Returns a list of paths that this page can be viewed at.
1753
+
1754
+ These values are combined with the dynamic portion of the page URL to
1755
+ automatically create redirects when the page's URL changes.
1756
+
1757
+ .. note::
1758
+
1759
+ If using ``RoutablePageMixin``, you may want to override this method
1760
+ to include the paths of popular routes.
1761
+
1762
+ .. note::
1763
+
1764
+ Redirect paths are 'normalized' to apply consistent ordering to GET parameters,
1765
+ so you don't need to include every variation. Fragment identifiers are discarded
1766
+ too, so should be avoided.
1767
+ """
1768
+ return ["/"]
1769
+
1770
+ def get_cached_paths(self):
1771
+ """
1772
+ This returns a list of paths to invalidate in a frontend cache
1773
+ """
1774
+ return ["/"]
1775
+
1776
+ def get_cache_key_components(self):
1777
+ """
1778
+ The components of a :class:`Page` which make up the :attr:`cache_key`. Any change to a
1779
+ page should be reflected in a change to at least one of these components.
1780
+ """
1781
+
1782
+ return [
1783
+ self.id,
1784
+ self.url_path,
1785
+ self.last_published_at.isoformat() if self.last_published_at else None,
1786
+ ]
1787
+
1788
+ @property
1789
+ def cache_key(self):
1790
+ """
1791
+ A generic cache key to identify a page in its current state.
1792
+ Should the page change, so will the key.
1793
+
1794
+ Customizations to the cache key should be made in :attr:`get_cache_key_components`.
1795
+ """
1796
+
1797
+ hasher = safe_md5()
1798
+
1799
+ for component in self.get_cache_key_components():
1800
+ hasher.update(force_bytes(component))
1801
+
1802
+ return hasher.hexdigest()
1803
+
1804
+ def get_sitemap_urls(self, request=None):
1805
+ return [
1806
+ {
1807
+ "location": self.get_full_url(request),
1808
+ # fall back on latest_revision_created_at if last_published_at is null
1809
+ # (for backwards compatibility from before last_published_at was added)
1810
+ "lastmod": (self.last_published_at or self.latest_revision_created_at),
1811
+ }
1812
+ ]
1813
+
1814
+ def get_ancestors(self, inclusive=False):
1815
+ """
1816
+ Returns a queryset of the current page's ancestors, starting at the root page
1817
+ and descending to the parent, or to the current page itself if ``inclusive`` is true.
1818
+ """
1819
+ return Page.objects.ancestor_of(self, inclusive)
1820
+
1821
+ def get_descendants(self, inclusive=False):
1822
+ """
1823
+ Returns a queryset of all pages underneath the current page, any number of levels deep.
1824
+ If ``inclusive`` is true, the current page itself is included in the queryset.
1825
+ """
1826
+ return Page.objects.descendant_of(self, inclusive)
1827
+
1828
+ def get_siblings(self, inclusive=True):
1829
+ """
1830
+ Returns a queryset of all other pages with the same parent as the current page.
1831
+ If ``inclusive`` is true, the current page itself is included in the queryset.
1832
+ """
1833
+ return Page.objects.sibling_of(self, inclusive)
1834
+
1835
+ def get_next_siblings(self, inclusive=False):
1836
+ return self.get_siblings(inclusive).filter(path__gte=self.path).order_by("path")
1837
+
1838
+ def get_prev_siblings(self, inclusive=False):
1839
+ return (
1840
+ self.get_siblings(inclusive).filter(path__lte=self.path).order_by("-path")
1841
+ )
1842
+
1843
+ def get_view_restrictions(self):
1844
+ """
1845
+ Return a query set of all page view restrictions that apply to this page.
1846
+
1847
+ This checks the current page and all ancestor pages for page view restrictions.
1848
+
1849
+ If any of those pages are aliases, it will resolve them to their source pages
1850
+ before querying PageViewRestrictions so alias pages use the same view restrictions
1851
+ as their source page and they cannot have their own.
1852
+ """
1853
+ page_ids_to_check = set()
1854
+
1855
+ def add_page_to_check_list(page):
1856
+ # If the page is an alias, add the source page to the check list instead
1857
+ if page.alias_of:
1858
+ add_page_to_check_list(page.alias_of)
1859
+ else:
1860
+ page_ids_to_check.add(page.id)
1861
+
1862
+ # Check current page for view restrictions
1863
+ add_page_to_check_list(self)
1864
+
1865
+ # Check each ancestor for view restrictions as well
1866
+ for page in self.get_ancestors().only("alias_of"):
1867
+ add_page_to_check_list(page)
1868
+
1869
+ return PageViewRestriction.objects.filter(page_id__in=page_ids_to_check)
1870
+
1871
+ password_required_template = None
1872
+
1873
+ def serve_password_required_response(self, request, form, action_url):
1874
+ """
1875
+ Serve a response indicating that the user has been denied access to view this page,
1876
+ and must supply a password.
1877
+ ``form`` = a Django form object containing the password input
1878
+ (and zero or more hidden fields that also need to be output on the template)
1879
+ ``action_url`` = URL that this form should be POSTed to
1880
+ """
1881
+
1882
+ password_required_template = self.password_required_template or getattr(
1883
+ settings,
1884
+ "WAGTAIL_PASSWORD_REQUIRED_TEMPLATE",
1885
+ "wagtailcore/password_required.html",
1886
+ )
1887
+
1888
+ context = self.get_context(request)
1889
+ context["form"] = form
1890
+ context["action_url"] = action_url
1891
+ return TemplateResponse(request, password_required_template, context)
1892
+
1893
+ def with_content_json(self, content):
1894
+ """
1895
+ Returns a new version of the page with field values updated to reflect changes
1896
+ in the provided ``content`` (which usually comes from a previously-saved
1897
+ page revision).
1898
+
1899
+ Certain field values are preserved in order to prevent errors if the returned
1900
+ page is saved, such as ``id``, ``content_type`` and some tree-related values.
1901
+ The following field values are also preserved, as they are considered to be
1902
+ meaningful to the page as a whole, rather than to a specific revision:
1903
+
1904
+ * ``draft_title``
1905
+ * ``live``
1906
+ * ``has_unpublished_changes``
1907
+ * ``owner``
1908
+ * ``locked``
1909
+ * ``locked_by``
1910
+ * ``locked_at``
1911
+ * ``latest_revision``
1912
+ * ``latest_revision_created_at``
1913
+ * ``first_published_at``
1914
+ * ``alias_of``
1915
+ * ``wagtail_admin_comments`` (COMMENTS_RELATION_NAME)
1916
+ """
1917
+
1918
+ # Old revisions (pre Wagtail 2.15) may have saved comment data under the name 'comments'
1919
+ # rather than the current relation name as set by COMMENTS_RELATION_NAME;
1920
+ # if a 'comments' field exists and looks like our comments model, alter the data to use
1921
+ # COMMENTS_RELATION_NAME before restoring
1922
+ if (
1923
+ COMMENTS_RELATION_NAME not in content
1924
+ and "comments" in content
1925
+ and isinstance(content["comments"], list)
1926
+ and len(content["comments"])
1927
+ and isinstance(content["comments"][0], dict)
1928
+ and "contentpath" in content["comments"][0]
1929
+ ):
1930
+ content[COMMENTS_RELATION_NAME] = content["comments"]
1931
+ del content["comments"]
1932
+
1933
+ obj = self.specific_class.from_serializable_data(content)
1934
+
1935
+ # These should definitely never change between revisions
1936
+ obj.id = self.id
1937
+ obj.pk = self.pk
1938
+ obj.content_type_id = self.content_type_id
1939
+
1940
+ # Override possibly-outdated tree parameter fields
1941
+ obj.path = self.path
1942
+ obj.depth = self.depth
1943
+ obj.numchild = self.numchild
1944
+
1945
+ # Update url_path to reflect potential slug changes, but maintaining the page's
1946
+ # existing tree position
1947
+ obj.set_url_path(self.get_parent())
1948
+
1949
+ # Ensure other values that are meaningful for the page as a whole (rather than
1950
+ # to a specific revision) are preserved
1951
+ obj.draft_title = self.draft_title
1952
+ obj.live = self.live
1953
+ obj.has_unpublished_changes = self.has_unpublished_changes
1954
+ obj.owner_id = self.owner_id
1955
+ obj.locked = self.locked
1956
+ obj.locked_by_id = self.locked_by_id
1957
+ obj.locked_at = self.locked_at
1958
+ obj.latest_revision_id = self.latest_revision_id
1959
+ obj.latest_revision_created_at = self.latest_revision_created_at
1960
+ obj.first_published_at = self.first_published_at
1961
+ obj.translation_key = self.translation_key
1962
+ obj.locale_id = self.locale_id
1963
+ obj.alias_of_id = self.alias_of_id
1964
+ revision_comment_positions = dict(
1965
+ getattr(obj, COMMENTS_RELATION_NAME).values_list("id", "position")
1966
+ )
1967
+ page_comments = (
1968
+ getattr(self, COMMENTS_RELATION_NAME)
1969
+ .filter(resolved_at__isnull=True)
1970
+ .defer("position")
1971
+ )
1972
+ for comment in page_comments:
1973
+ # attempt to retrieve the comment position from the revision's stored version
1974
+ # of the comment
1975
+ try:
1976
+ comment.position = revision_comment_positions[comment.id]
1977
+ except KeyError:
1978
+ pass
1979
+ setattr(obj, COMMENTS_RELATION_NAME, page_comments)
1980
+
1981
+ return obj
1982
+
1983
+ @property
1984
+ def has_workflow(self):
1985
+ """
1986
+ Returns ``True`` if the page or an ancestor has an active workflow assigned, otherwise ``False``.
1987
+ """
1988
+ if not getattr(settings, "WAGTAIL_WORKFLOW_ENABLED", True):
1989
+ return False
1990
+ return (
1991
+ self.get_ancestors(inclusive=True)
1992
+ .filter(workflowpage__isnull=False)
1993
+ .filter(workflowpage__workflow__active=True)
1994
+ .exists()
1995
+ )
1996
+
1997
+ def get_workflow(self):
1998
+ """
1999
+ Returns the active workflow assigned to the page or its nearest ancestor.
2000
+ """
2001
+ if not getattr(settings, "WAGTAIL_WORKFLOW_ENABLED", True):
2002
+ return None
2003
+
2004
+ if hasattr(self, "workflowpage") and self.workflowpage.workflow.active:
2005
+ return self.workflowpage.workflow
2006
+ else:
2007
+ try:
2008
+ workflow = (
2009
+ self.get_ancestors()
2010
+ .filter(workflowpage__isnull=False)
2011
+ .filter(workflowpage__workflow__active=True)
2012
+ .order_by("-depth")
2013
+ .first()
2014
+ .workflowpage.workflow
2015
+ )
2016
+ except AttributeError:
2017
+ workflow = None
2018
+ return workflow
2019
+
2020
+ class Meta:
2021
+ verbose_name = _("page")
2022
+ verbose_name_plural = _("pages")
2023
+ unique_together = [("translation_key", "locale")]
2024
+ # Make sure that we auto-create Permission objects that are defined in
2025
+ # PAGE_PERMISSION_TYPES, skipping the default_permissions from Django.
2026
+ permissions = [
2027
+ (codename, name)
2028
+ for codename, _, name in PAGE_PERMISSION_TYPES
2029
+ if codename not in {"add_page", "change_page", "delete_page", "view_page"}
2030
+ ]
2031
+
2032
+
2033
+ # set module path of Page so that when Sphinx autodoc sees Page in type annotations
2034
+ # it won't complain that there's no target for wagtail.models.pages.Page
2035
+ Page.__module__ = "wagtail.models"
2036
+
2037
+
2038
+ class GroupPagePermissionManager(models.Manager):
2039
+ def create(self, **kwargs):
2040
+ # Simplify creation of GroupPagePermission objects by allowing one
2041
+ # of permission or permission_type to be passed in.
2042
+ permission = kwargs.get("permission")
2043
+ permission_type = kwargs.pop("permission_type", None)
2044
+ if not permission and permission_type:
2045
+ kwargs["permission"] = Permission.objects.get(
2046
+ content_type=get_default_page_content_type(),
2047
+ codename=f"{permission_type}_page",
2048
+ )
2049
+ return super().create(**kwargs)
2050
+
2051
+
2052
+ class GroupPagePermission(models.Model):
2053
+ group = models.ForeignKey(
2054
+ Group,
2055
+ verbose_name=_("group"),
2056
+ related_name="page_permissions",
2057
+ on_delete=models.CASCADE,
2058
+ )
2059
+ page = models.ForeignKey(
2060
+ "Page",
2061
+ verbose_name=_("page"),
2062
+ related_name="group_permissions",
2063
+ on_delete=models.CASCADE,
2064
+ )
2065
+ permission = models.ForeignKey(
2066
+ Permission,
2067
+ verbose_name=_("permission"),
2068
+ on_delete=models.CASCADE,
2069
+ )
2070
+
2071
+ objects = GroupPagePermissionManager()
2072
+
2073
+ class Meta:
2074
+ constraints = [
2075
+ models.UniqueConstraint(
2076
+ fields=("group", "page", "permission"),
2077
+ name="unique_permission",
2078
+ ),
2079
+ ]
2080
+ verbose_name = _("group page permission")
2081
+ verbose_name_plural = _("group page permissions")
2082
+
2083
+ def __str__(self):
2084
+ return "Group %d ('%s') has permission '%s' on page %d ('%s')" % (
2085
+ self.group.id,
2086
+ self.group,
2087
+ self.permission.codename,
2088
+ self.page.id,
2089
+ self.page,
2090
+ )
2091
+
2092
+
2093
+ class PagePermissionTester:
2094
+ def __init__(self, user, page):
2095
+ from wagtail.permissions import page_permission_policy
2096
+
2097
+ self.user = user
2098
+ self.permission_policy = page_permission_policy
2099
+ self.page = page
2100
+ self.page_is_root = page.depth == 1 # Equivalent to page.is_root()
2101
+
2102
+ if self.user.is_active and not self.user.is_superuser:
2103
+ self.permissions = {
2104
+ # Get the 'action' part of the permission codename, e.g.
2105
+ # 'add' instead of 'add_page'
2106
+ perm.permission.codename.rsplit("_", maxsplit=1)[0]
2107
+ for perm in self.permission_policy.get_cached_permissions_for_user(user)
2108
+ if self.page.path.startswith(perm.page.path)
2109
+ }
2110
+
2111
+ def user_has_lock(self):
2112
+ return self.page.locked_by_id == self.user.pk
2113
+
2114
+ def page_locked(self):
2115
+ lock = self.page.get_lock()
2116
+ return lock and lock.for_user(self.user)
2117
+
2118
+ def can_add_subpage(self):
2119
+ if not self.user.is_active:
2120
+ return False
2121
+ specific_class = self.page.specific_class
2122
+ if specific_class is None or not specific_class.creatable_subpage_models():
2123
+ return False
2124
+ return self.user.is_superuser or ("add" in self.permissions)
2125
+
2126
+ def can_edit(self):
2127
+ if not self.user.is_active:
2128
+ return False
2129
+
2130
+ if (
2131
+ self.page_is_root
2132
+ ): # root node is not a page and can never be edited, even by superusers
2133
+ return False
2134
+
2135
+ if self.user.is_superuser:
2136
+ return True
2137
+
2138
+ if "change" in self.permissions:
2139
+ return True
2140
+
2141
+ if "add" in self.permissions and self.page.owner_id == self.user.pk:
2142
+ return True
2143
+
2144
+ current_workflow_task = self.page.current_workflow_task
2145
+ if current_workflow_task:
2146
+ if current_workflow_task.user_can_access_editor(self.page, self.user):
2147
+ return True
2148
+
2149
+ return False
2150
+
2151
+ def can_delete(self, ignore_bulk=False):
2152
+ if not self.user.is_active:
2153
+ return False
2154
+
2155
+ if (
2156
+ self.page_is_root
2157
+ ): # root node is not a page and can never be deleted, even by superusers
2158
+ return False
2159
+
2160
+ if self.user.is_superuser:
2161
+ # superusers require no further checks
2162
+ return True
2163
+
2164
+ # if the user does not have bulk_delete permission, they may only delete leaf pages
2165
+ if (
2166
+ "bulk_delete" not in self.permissions
2167
+ and not self.page.is_leaf()
2168
+ and not ignore_bulk
2169
+ ):
2170
+ return False
2171
+
2172
+ if "change" in self.permissions:
2173
+ # if the user does not have publish permission, we also need to confirm that there
2174
+ # are no published pages here
2175
+ if "publish" not in self.permissions:
2176
+ pages_to_delete = self.page.get_descendants(inclusive=True)
2177
+ if pages_to_delete.live().exists():
2178
+ return False
2179
+
2180
+ return True
2181
+
2182
+ elif "add" in self.permissions:
2183
+ pages_to_delete = self.page.get_descendants(inclusive=True)
2184
+ if "publish" in self.permissions:
2185
+ # we don't care about live state, but all pages must be owned by this user
2186
+ # (i.e. eliminating pages owned by this user must give us the empty set)
2187
+ return not pages_to_delete.exclude(owner=self.user).exists()
2188
+ else:
2189
+ # all pages must be owned by this user and non-live
2190
+ # (i.e. eliminating non-live pages owned by this user must give us the empty set)
2191
+ return not pages_to_delete.exclude(live=False, owner=self.user).exists()
2192
+
2193
+ else:
2194
+ return False
2195
+
2196
+ def can_unpublish(self):
2197
+ if not self.user.is_active:
2198
+ return False
2199
+ if (not self.page.live) or self.page_is_root:
2200
+ return False
2201
+ if self.page_locked():
2202
+ return False
2203
+
2204
+ return self.user.is_superuser or ("publish" in self.permissions)
2205
+
2206
+ def can_publish(self):
2207
+ if not self.user.is_active:
2208
+ return False
2209
+ if self.page_is_root:
2210
+ return False
2211
+
2212
+ return self.user.is_superuser or ("publish" in self.permissions)
2213
+
2214
+ def can_submit_for_moderation(self):
2215
+ return (
2216
+ not self.page_locked()
2217
+ and self.page.has_workflow
2218
+ and not self.page.workflow_in_progress
2219
+ )
2220
+
2221
+ def can_set_view_restrictions(self):
2222
+ return self.can_publish()
2223
+
2224
+ def can_unschedule(self):
2225
+ return self.can_publish()
2226
+
2227
+ def can_lock(self):
2228
+ if self.user.is_superuser:
2229
+ return True
2230
+ current_workflow_task = self.page.current_workflow_task
2231
+ if current_workflow_task:
2232
+ return current_workflow_task.user_can_lock(self.page, self.user)
2233
+
2234
+ if "lock" in self.permissions:
2235
+ return True
2236
+
2237
+ return False
2238
+
2239
+ def can_unlock(self):
2240
+ if self.user.is_superuser:
2241
+ return True
2242
+
2243
+ if self.user_has_lock():
2244
+ return True
2245
+
2246
+ current_workflow_task = self.page.current_workflow_task
2247
+ if current_workflow_task:
2248
+ return current_workflow_task.user_can_unlock(self.page, self.user)
2249
+
2250
+ if "unlock" in self.permissions:
2251
+ return True
2252
+
2253
+ return False
2254
+
2255
+ def can_publish_subpage(self):
2256
+ """
2257
+ Niggly special case for creating and publishing a page in one go.
2258
+ Differs from can_publish in that we want to be able to publish subpages of root, but not
2259
+ to be able to publish root itself. (Also, can_publish_subpage returns false if the page
2260
+ does not allow subpages at all.)
2261
+ """
2262
+ if not self.user.is_active:
2263
+ return False
2264
+ specific_class = self.page.specific_class
2265
+ if specific_class is None or not specific_class.creatable_subpage_models():
2266
+ return False
2267
+
2268
+ return self.user.is_superuser or ("publish" in self.permissions)
2269
+
2270
+ def can_reorder_children(self):
2271
+ """
2272
+ Reorder permission checking is similar to publishing a subpage, since it immediately
2273
+ affects published pages. However, it shouldn't care about the 'creatability' of
2274
+ page types, because the action only ever updates existing pages.
2275
+ """
2276
+ if not self.user.is_active:
2277
+ return False
2278
+ return self.user.is_superuser or ("publish" in self.permissions)
2279
+
2280
+ def can_move(self):
2281
+ """
2282
+ Moving a page should be logically equivalent to deleting and re-adding it (and all its children).
2283
+ As such, the permission test for 'can this be moved at all?' should be the same as for deletion.
2284
+ (Further constraints will then apply on where it can be moved *to*.)
2285
+ """
2286
+ return self.can_delete(ignore_bulk=True)
2287
+
2288
+ def can_copy(self):
2289
+ return not self.page_is_root
2290
+
2291
+ def can_move_to(self, destination):
2292
+ # reject the logically impossible cases first
2293
+ if self.page == destination or destination.is_descendant_of(self.page):
2294
+ return False
2295
+
2296
+ # reject moves that are forbidden by subpage_types / parent_page_types rules
2297
+ # (these rules apply to superusers too)
2298
+ # – but only check this if the page is not already under the target parent.
2299
+ # If it already is, then the user is just reordering the page, and we want
2300
+ # to allow it even if the page currently violates the subpage_type /
2301
+ # parent_page_type rules. This can happen if it was either created before
2302
+ # the rules were specified, or it was done programmatically (e.g. to
2303
+ # predefine a set of pages and disallow the creation of new subpages by
2304
+ # setting subpage_types = []).
2305
+
2306
+ if (not self.page.is_child_of(destination)) and (
2307
+ not self.page.specific.can_move_to(destination)
2308
+ ):
2309
+ return False
2310
+
2311
+ # shortcut the trivial 'everything' / 'nothing' permissions
2312
+ if not self.user.is_active:
2313
+ return False
2314
+ if self.user.is_superuser:
2315
+ return True
2316
+
2317
+ # check that the page can be moved at all
2318
+ if not self.can_move():
2319
+ return False
2320
+
2321
+ # Inspect permissions on the destination
2322
+ destination_perms = destination.permissions_for_user(self.user)
2323
+
2324
+ # we always need at least add permission in the target
2325
+ if "add" not in destination_perms.permissions:
2326
+ return False
2327
+
2328
+ if self.page.live or self.page.get_descendants().filter(live=True).exists():
2329
+ # moving this page will entail publishing within the destination section
2330
+ return "publish" in destination_perms.permissions
2331
+ else:
2332
+ # no publishing required, so the already-tested 'add' permission is sufficient
2333
+ return True
2334
+
2335
+ def can_copy_to(self, destination, recursive=False):
2336
+ # reject the logically impossible cases first
2337
+ # recursive can't copy to the same tree otherwise it will be on infinite loop
2338
+ if recursive and (
2339
+ self.page == destination or destination.is_descendant_of(self.page)
2340
+ ):
2341
+ return False
2342
+
2343
+ # reject inactive users early
2344
+ if not self.user.is_active:
2345
+ return False
2346
+
2347
+ # reject early if pages of this type cannot be created at the destination
2348
+ if not self.page.specific_class.can_create_at(destination):
2349
+ return False
2350
+
2351
+ # skip permission checking for super users
2352
+ if self.user.is_superuser:
2353
+ return True
2354
+
2355
+ # Inspect permissions on the destination
2356
+ destination_perms = destination.permissions_for_user(self.user)
2357
+
2358
+ if not destination.specific_class.creatable_subpage_models():
2359
+ return False
2360
+
2361
+ # we always need at least add permission in the target
2362
+ if "add" not in destination_perms.permissions:
2363
+ return False
2364
+
2365
+ return True
2366
+
2367
+ def can_view_revisions(self):
2368
+ return not self.page_is_root
2369
+
2370
+
2371
+ class PageViewRestriction(BaseViewRestriction):
2372
+ page = models.ForeignKey(
2373
+ "Page",
2374
+ verbose_name=_("page"),
2375
+ related_name="view_restrictions",
2376
+ on_delete=models.CASCADE,
2377
+ )
2378
+
2379
+ passed_view_restrictions_session_key = "passed_page_view_restrictions"
2380
+
2381
+ class Meta:
2382
+ verbose_name = _("page view restriction")
2383
+ verbose_name_plural = _("page view restrictions")
2384
+
2385
+ def save(self, user=None, **kwargs):
2386
+ """
2387
+ Custom save handler to include logging.
2388
+ :param user: the user add/updating the view restriction
2389
+ :param specific_instance: the specific model instance the restriction applies to
2390
+ """
2391
+ specific_instance = self.page.specific
2392
+ is_new = self.id is None
2393
+ super().save(**kwargs)
2394
+
2395
+ if specific_instance:
2396
+ log(
2397
+ instance=specific_instance,
2398
+ action="wagtail.view_restriction.create"
2399
+ if is_new
2400
+ else "wagtail.view_restriction.edit",
2401
+ user=user,
2402
+ data={
2403
+ "restriction": {
2404
+ "type": self.restriction_type,
2405
+ "title": force_str(
2406
+ dict(self.RESTRICTION_CHOICES).get(self.restriction_type)
2407
+ ),
2408
+ }
2409
+ },
2410
+ )
2411
+
2412
+ def delete(self, user=None, **kwargs):
2413
+ """
2414
+ Custom delete handler to aid in logging.
2415
+ :param user: the user removing the view restriction
2416
+ """
2417
+ specific_instance = self.page.specific
2418
+ if specific_instance:
2419
+ removed_restriction_type = PageViewRestriction.objects.filter(
2420
+ id=self.id
2421
+ ).values_list("restriction_type", flat=True)[0]
2422
+ log(
2423
+ instance=specific_instance,
2424
+ action="wagtail.view_restriction.delete",
2425
+ user=user,
2426
+ data={
2427
+ "restriction": {
2428
+ "type": self.restriction_type,
2429
+ "title": force_str(
2430
+ dict(self.RESTRICTION_CHOICES).get(removed_restriction_type)
2431
+ ),
2432
+ }
2433
+ },
2434
+ )
2435
+ return super().delete(**kwargs)
2436
+
2437
+
2438
+ class WorkflowPage(models.Model):
2439
+ page = models.OneToOneField(
2440
+ "Page",
2441
+ verbose_name=_("page"),
2442
+ on_delete=models.CASCADE,
2443
+ primary_key=True,
2444
+ unique=True,
2445
+ )
2446
+ workflow = models.ForeignKey(
2447
+ "Workflow",
2448
+ related_name="workflow_pages",
2449
+ verbose_name=_("workflow"),
2450
+ on_delete=models.CASCADE,
2451
+ )
2452
+
2453
+ def get_pages(self):
2454
+ """
2455
+ Returns a queryset of pages that are affected by this ``WorkflowPage`` link.
2456
+
2457
+ This includes all descendants of the page excluding any that have other ``WorkflowPage``(s).
2458
+ """
2459
+ descendant_pages = Page.objects.descendant_of(self.page, inclusive=True)
2460
+ descendant_workflow_pages = WorkflowPage.objects.filter(
2461
+ page_id__in=descendant_pages.values_list("id", flat=True)
2462
+ ).exclude(pk=self.pk)
2463
+
2464
+ for path, depth in descendant_workflow_pages.values_list(
2465
+ "page__path", "page__depth"
2466
+ ):
2467
+ descendant_pages = descendant_pages.exclude(
2468
+ path__startswith=path, depth__gte=depth
2469
+ )
2470
+
2471
+ return descendant_pages
2472
+
2473
+ class Meta:
2474
+ verbose_name = _("workflow page")
2475
+ verbose_name_plural = _("workflow pages")
2476
+
2477
+
2478
+ class PageLogEntryQuerySet(LogEntryQuerySet):
2479
+ def get_content_type_ids(self):
2480
+ # for reporting purposes, pages of all types are combined under a single "Page"
2481
+ # object type
2482
+ if self.exists():
2483
+ return {ContentType.objects.get_for_model(Page).pk}
2484
+ else:
2485
+ return set()
2486
+
2487
+ def filter_on_content_type(self, content_type):
2488
+ if content_type == ContentType.objects.get_for_model(Page):
2489
+ return self
2490
+ else:
2491
+ return self.none()
2492
+
2493
+
2494
+ class PageLogEntryManager(BaseLogEntryManager):
2495
+ def get_queryset(self):
2496
+ return PageLogEntryQuerySet(self.model, using=self._db)
2497
+
2498
+ def get_instance_title(self, instance):
2499
+ return instance.specific_deferred.get_admin_display_title()
2500
+
2501
+ def log_action(self, instance, action, **kwargs):
2502
+ kwargs.update(page=instance)
2503
+ return super().log_action(instance, action, **kwargs)
2504
+
2505
+ def viewable_by_user(self, user):
2506
+ from wagtail.permissions import page_permission_policy
2507
+
2508
+ explorable_instances = page_permission_policy.explorable_instances(user)
2509
+ q = Q(page__in=explorable_instances.values_list("pk", flat=True))
2510
+
2511
+ root_page_permissions = Page.get_first_root_node().permissions_for_user(user)
2512
+ if (
2513
+ user.is_superuser
2514
+ or root_page_permissions.can_add_subpage()
2515
+ or root_page_permissions.can_edit()
2516
+ ):
2517
+ # Include deleted entries
2518
+ q = q | Q(
2519
+ page_id__in=Subquery(
2520
+ PageLogEntry.objects.filter(deleted=True).values("page_id")
2521
+ )
2522
+ )
2523
+
2524
+ return PageLogEntry.objects.filter(q)
2525
+
2526
+ def for_instance(self, instance):
2527
+ return self.filter(page=instance)
2528
+
2529
+
2530
+ class PageLogEntry(BaseLogEntry):
2531
+ page = models.ForeignKey(
2532
+ "wagtailcore.Page",
2533
+ on_delete=models.DO_NOTHING,
2534
+ db_constraint=False,
2535
+ related_name="+",
2536
+ )
2537
+
2538
+ objects = PageLogEntryManager()
2539
+
2540
+ class Meta:
2541
+ ordering = ["-timestamp", "-id"]
2542
+ verbose_name = _("page log entry")
2543
+ verbose_name_plural = _("page log entries")
2544
+
2545
+ def __str__(self):
2546
+ return "PageLogEntry %d: '%s' on '%s' with id %s" % (
2547
+ self.pk,
2548
+ self.action,
2549
+ self.object_verbose_name(),
2550
+ self.page_id,
2551
+ )
2552
+
2553
+ @cached_property
2554
+ def object_id(self):
2555
+ return self.page_id
2556
+
2557
+ @cached_property
2558
+ def message(self):
2559
+ # for page log entries, the 'edit' action should show as 'Draft saved'
2560
+ if self.action == "wagtail.edit":
2561
+ return _("Draft saved")
2562
+ else:
2563
+ return super().message
2564
+
2565
+
2566
+ class Comment(ClusterableModel):
2567
+ """
2568
+ A comment on a field, or a field within a streamfield block
2569
+ """
2570
+
2571
+ page = ParentalKey(
2572
+ Page, on_delete=models.CASCADE, related_name=COMMENTS_RELATION_NAME
2573
+ )
2574
+ user = models.ForeignKey(
2575
+ settings.AUTH_USER_MODEL,
2576
+ on_delete=models.CASCADE,
2577
+ related_name=COMMENTS_RELATION_NAME,
2578
+ )
2579
+ text = models.TextField()
2580
+
2581
+ contentpath = models.TextField()
2582
+ # This stores the field or field within a streamfield block that the comment is applied on, in the form: 'field', or 'field.block_id.field'
2583
+ # This must be unchanging across all revisions, so we will not support (current-format) ListBlock or the contents of InlinePanels initially.
2584
+
2585
+ position = models.TextField(blank=True)
2586
+ # This stores the position within a field, to be interpreted by the field's frontend widget. It may change between revisions
2587
+
2588
+ created_at = models.DateTimeField(auto_now_add=True)
2589
+ updated_at = models.DateTimeField(auto_now=True)
2590
+
2591
+ revision_created = models.ForeignKey(
2592
+ Revision,
2593
+ on_delete=models.CASCADE,
2594
+ related_name="created_comments",
2595
+ null=True,
2596
+ blank=True,
2597
+ )
2598
+
2599
+ resolved_at = models.DateTimeField(null=True, blank=True)
2600
+ resolved_by = models.ForeignKey(
2601
+ settings.AUTH_USER_MODEL,
2602
+ on_delete=models.SET_NULL,
2603
+ related_name="comments_resolved",
2604
+ null=True,
2605
+ blank=True,
2606
+ )
2607
+
2608
+ class Meta:
2609
+ verbose_name = _("comment")
2610
+ verbose_name_plural = _("comments")
2611
+
2612
+ def __str__(self):
2613
+ return "Comment on Page '{}', left by {}: '{}'".format(
2614
+ self.page, self.user, self.text
2615
+ )
2616
+
2617
+ def save(self, update_position=False, **kwargs):
2618
+ # Don't save the position unless specifically instructed to, as the position will normally be retrieved from the revision
2619
+ update_fields = kwargs.pop("update_fields", None)
2620
+ if not update_position and (
2621
+ not update_fields or "position" not in update_fields
2622
+ ):
2623
+ if self.id:
2624
+ # The instance is already saved; we can use `update_fields`
2625
+ update_fields = (
2626
+ update_fields if update_fields else self._meta.get_fields()
2627
+ )
2628
+ update_fields = [
2629
+ field.name
2630
+ for field in update_fields
2631
+ if field.name not in {"position", "id"}
2632
+ ]
2633
+ else:
2634
+ # This is a new instance, we have to preserve and then restore the position via a variable
2635
+ position = self.position
2636
+ result = super().save(**kwargs)
2637
+ self.position = position
2638
+ return result
2639
+ return super().save(update_fields=update_fields, **kwargs)
2640
+
2641
+ def _log(self, action, page_revision=None, user=None):
2642
+ log(
2643
+ instance=self.page,
2644
+ action=action,
2645
+ user=user,
2646
+ revision=page_revision,
2647
+ data={
2648
+ "comment": {
2649
+ "id": self.pk,
2650
+ "contentpath": self.contentpath,
2651
+ "text": self.text,
2652
+ }
2653
+ },
2654
+ )
2655
+
2656
+ def log_create(self, **kwargs):
2657
+ self._log("wagtail.comments.create", **kwargs)
2658
+
2659
+ def log_edit(self, **kwargs):
2660
+ self._log("wagtail.comments.edit", **kwargs)
2661
+
2662
+ def log_resolve(self, **kwargs):
2663
+ self._log("wagtail.comments.resolve", **kwargs)
2664
+
2665
+ def log_delete(self, **kwargs):
2666
+ self._log("wagtail.comments.delete", **kwargs)
2667
+
2668
+ def has_valid_contentpath(self, page):
2669
+ """
2670
+ Return True if this comment's contentpath corresponds to a valid field or
2671
+ StreamField block on the given page object.
2672
+ """
2673
+ field_name, *remainder = self.contentpath.split(".")
2674
+ try:
2675
+ field = page._meta.get_field(field_name)
2676
+ except FieldDoesNotExist:
2677
+ return False
2678
+
2679
+ if not remainder:
2680
+ # comment applies to the field as a whole
2681
+ return True
2682
+
2683
+ if not isinstance(field, StreamField):
2684
+ # only StreamField supports content paths that are deeper than one level
2685
+ return False
2686
+
2687
+ stream_value = getattr(page, field_name)
2688
+ block = field.get_block_by_content_path(stream_value, remainder)
2689
+ # content path is valid if this returns a BoundBlock rather than None
2690
+ return bool(block)
2691
+
2692
+
2693
+ class CommentReply(models.Model):
2694
+ comment = ParentalKey(Comment, on_delete=models.CASCADE, related_name="replies")
2695
+ user = models.ForeignKey(
2696
+ settings.AUTH_USER_MODEL,
2697
+ on_delete=models.CASCADE,
2698
+ related_name="comment_replies",
2699
+ )
2700
+ text = models.TextField()
2701
+ created_at = models.DateTimeField(auto_now_add=True)
2702
+ updated_at = models.DateTimeField(auto_now=True)
2703
+
2704
+ class Meta:
2705
+ verbose_name = _("comment reply")
2706
+ verbose_name_plural = _("comment replies")
2707
+
2708
+ def __str__(self):
2709
+ return f"CommentReply left by '{self.user}': '{self.text}'"
2710
+
2711
+ def _log(self, action, page_revision=None, user=None):
2712
+ log(
2713
+ instance=self.comment.page,
2714
+ action=action,
2715
+ user=user,
2716
+ revision=page_revision,
2717
+ data={
2718
+ "comment": {
2719
+ "id": self.comment.pk,
2720
+ "contentpath": self.comment.contentpath,
2721
+ "text": self.comment.text,
2722
+ },
2723
+ "reply": {
2724
+ "id": self.pk,
2725
+ "text": self.text,
2726
+ },
2727
+ },
2728
+ )
2729
+
2730
+ def log_create(self, **kwargs):
2731
+ self._log("wagtail.comments.create_reply", **kwargs)
2732
+
2733
+ def log_edit(self, **kwargs):
2734
+ self._log("wagtail.comments.edit_reply", **kwargs)
2735
+
2736
+ def log_delete(self, **kwargs):
2737
+ self._log("wagtail.comments.delete_reply", **kwargs)
2738
+
2739
+
2740
+ class PageSubscription(models.Model):
2741
+ user = models.ForeignKey(
2742
+ settings.AUTH_USER_MODEL,
2743
+ on_delete=models.CASCADE,
2744
+ related_name="page_subscriptions",
2745
+ )
2746
+ page = models.ForeignKey(Page, on_delete=models.CASCADE, related_name="subscribers")
2747
+
2748
+ comment_notifications = models.BooleanField()
2749
+
2750
+ wagtail_reference_index_ignore = True
2751
+
2752
+ class Meta:
2753
+ unique_together = [
2754
+ ("page", "user"),
2755
+ ]