wagtail 6.1.1__py3-none-any.whl → 6.1.3__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 (147) hide show
  1. wagtail/__init__.py +1 -1
  2. wagtail/admin/locale/ca/LC_MESSAGES/django.mo +0 -0
  3. wagtail/admin/locale/ca/LC_MESSAGES/django.po +1 -1
  4. wagtail/admin/locale/fa/LC_MESSAGES/django.mo +0 -0
  5. wagtail/admin/locale/fa/LC_MESSAGES/django.po +75 -1
  6. wagtail/admin/locale/fa/LC_MESSAGES/djangojs.mo +0 -0
  7. wagtail/admin/locale/fa/LC_MESSAGES/djangojs.po +5 -1
  8. wagtail/admin/locale/fr/LC_MESSAGES/django.mo +0 -0
  9. wagtail/admin/locale/fr/LC_MESSAGES/django.po +89 -3
  10. wagtail/admin/locale/is_IS/LC_MESSAGES/django.mo +0 -0
  11. wagtail/admin/locale/is_IS/LC_MESSAGES/django.po +228 -2
  12. wagtail/admin/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
  13. wagtail/admin/locale/pt_BR/LC_MESSAGES/django.po +20 -1
  14. wagtail/admin/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
  15. wagtail/admin/locale/sk_SK/LC_MESSAGES/django.po +11 -1
  16. wagtail/admin/locale/sl/LC_MESSAGES/django.mo +0 -0
  17. wagtail/admin/locale/sl/LC_MESSAGES/django.po +97 -0
  18. wagtail/admin/locale/sv/LC_MESSAGES/django.mo +0 -0
  19. wagtail/admin/locale/sv/LC_MESSAGES/django.po +74 -0
  20. wagtail/admin/locale/sv/LC_MESSAGES/djangojs.mo +0 -0
  21. wagtail/admin/locale/sv/LC_MESSAGES/djangojs.po +5 -2
  22. wagtail/admin/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  23. wagtail/admin/locale/zh_Hans/LC_MESSAGES/django.po +71 -1
  24. wagtail/admin/static/wagtailadmin/js/telepath/widgets.js +1 -1
  25. wagtail/admin/views/generic/base.py +3 -2
  26. wagtail/contrib/forms/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
  27. wagtail/contrib/forms/locale/pt_BR/LC_MESSAGES/django.po +2 -2
  28. wagtail/contrib/redirects/locale/fa/LC_MESSAGES/django.mo +0 -0
  29. wagtail/contrib/redirects/locale/fa/LC_MESSAGES/django.po +14 -1
  30. wagtail/contrib/redirects/locale/pt_BR/LC_MESSAGES/django.po +1 -1
  31. wagtail/contrib/search_promotions/locale/fr/LC_MESSAGES/django.mo +0 -0
  32. wagtail/contrib/search_promotions/locale/fr/LC_MESSAGES/django.po +5 -2
  33. wagtail/contrib/search_promotions/locale/is_IS/LC_MESSAGES/django.mo +0 -0
  34. wagtail/contrib/search_promotions/locale/is_IS/LC_MESSAGES/django.po +6 -2
  35. wagtail/contrib/search_promotions/locale/sl/LC_MESSAGES/django.mo +0 -0
  36. wagtail/contrib/search_promotions/locale/sl/LC_MESSAGES/django.po +56 -2
  37. wagtail/contrib/search_promotions/locale/sv/LC_MESSAGES/django.mo +0 -0
  38. wagtail/contrib/search_promotions/locale/sv/LC_MESSAGES/django.po +5 -2
  39. wagtail/contrib/settings/locale/hi/LC_MESSAGES/django.po +1 -1
  40. wagtail/contrib/settings/locale/pt_BR/LC_MESSAGES/django.po +1 -1
  41. wagtail/contrib/settings/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
  42. wagtail/contrib/settings/locale/sk_SK/LC_MESSAGES/django.po +10 -1
  43. wagtail/contrib/settings/tests/generic/test_admin.py +144 -16
  44. wagtail/contrib/settings/tests/site_specific/test_admin.py +142 -17
  45. wagtail/contrib/settings/views.py +3 -0
  46. wagtail/contrib/simple_translation/locale/pt_BR/LC_MESSAGES/django.po +1 -1
  47. wagtail/contrib/styleguide/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
  48. wagtail/contrib/styleguide/locale/sk_SK/LC_MESSAGES/django.po +5 -1
  49. wagtail/contrib/styleguide/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  50. wagtail/contrib/styleguide/locale/zh_Hans/LC_MESSAGES/django.po +3 -0
  51. wagtail/contrib/styleguide/tests.py +33 -0
  52. wagtail/contrib/styleguide/views.py +4 -1
  53. wagtail/contrib/table_block/locale/fr/LC_MESSAGES/django.mo +0 -0
  54. wagtail/contrib/table_block/locale/fr/LC_MESSAGES/django.po +27 -1
  55. wagtail/contrib/table_block/locale/is_IS/LC_MESSAGES/django.mo +0 -0
  56. wagtail/contrib/table_block/locale/is_IS/LC_MESSAGES/django.po +28 -2
  57. wagtail/contrib/table_block/locale/sl/LC_MESSAGES/django.mo +0 -0
  58. wagtail/contrib/table_block/locale/sl/LC_MESSAGES/django.po +27 -1
  59. wagtail/contrib/typed_table_block/locale/fr/LC_MESSAGES/django.mo +0 -0
  60. wagtail/contrib/typed_table_block/locale/fr/LC_MESSAGES/django.po +12 -1
  61. wagtail/contrib/typed_table_block/locale/is_IS/LC_MESSAGES/django.mo +0 -0
  62. wagtail/contrib/typed_table_block/locale/is_IS/LC_MESSAGES/django.po +12 -1
  63. wagtail/contrib/typed_table_block/locale/pt_BR/LC_MESSAGES/django.po +1 -1
  64. wagtail/contrib/typed_table_block/locale/sl/LC_MESSAGES/django.mo +0 -0
  65. wagtail/contrib/typed_table_block/locale/sl/LC_MESSAGES/django.po +12 -2
  66. wagtail/documents/locale/ca/LC_MESSAGES/django.mo +0 -0
  67. wagtail/documents/locale/ca/LC_MESSAGES/django.po +3 -2
  68. wagtail/documents/locale/fa/LC_MESSAGES/django.mo +0 -0
  69. wagtail/documents/locale/fa/LC_MESSAGES/django.po +9 -0
  70. wagtail/documents/locale/is_IS/LC_MESSAGES/django.mo +0 -0
  71. wagtail/documents/locale/is_IS/LC_MESSAGES/django.po +17 -2
  72. wagtail/documents/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
  73. wagtail/documents/locale/sk_SK/LC_MESSAGES/django.po +45 -2
  74. wagtail/documents/locale/sl/LC_MESSAGES/django.mo +0 -0
  75. wagtail/documents/locale/sl/LC_MESSAGES/django.po +11 -2
  76. wagtail/documents/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  77. wagtail/documents/locale/zh_Hans/LC_MESSAGES/django.po +7 -1
  78. wagtail/images/locale/fa/LC_MESSAGES/django.mo +0 -0
  79. wagtail/images/locale/fa/LC_MESSAGES/django.po +20 -1
  80. wagtail/images/locale/is_IS/LC_MESSAGES/django.mo +0 -0
  81. wagtail/images/locale/is_IS/LC_MESSAGES/django.po +28 -2
  82. wagtail/images/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
  83. wagtail/images/locale/sk_SK/LC_MESSAGES/django.po +15 -0
  84. wagtail/images/locale/sl/LC_MESSAGES/django.mo +0 -0
  85. wagtail/images/locale/sl/LC_MESSAGES/django.po +14 -2
  86. wagtail/images/locale/sv/LC_MESSAGES/django.mo +0 -0
  87. wagtail/images/locale/sv/LC_MESSAGES/django.po +14 -2
  88. wagtail/images/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  89. wagtail/images/locale/zh_Hans/LC_MESSAGES/django.po +45 -1
  90. wagtail/images/models.py +1 -0
  91. wagtail/images/tests/test_admin_views.py +32 -0
  92. wagtail/images/tests/test_image_operations.py +12 -0
  93. wagtail/images/tests/tests.py +27 -2
  94. wagtail/images/views/images.py +7 -3
  95. wagtail/images/views/serve.py +1 -0
  96. wagtail/locale/fa/LC_MESSAGES/django.mo +0 -0
  97. wagtail/locale/fa/LC_MESSAGES/django.po +3 -0
  98. wagtail/locale/fr/LC_MESSAGES/django.mo +0 -0
  99. wagtail/locale/fr/LC_MESSAGES/django.po +23 -4
  100. wagtail/locale/is_IS/LC_MESSAGES/django.mo +0 -0
  101. wagtail/locale/is_IS/LC_MESSAGES/django.po +22 -2
  102. wagtail/locale/pt_BR/LC_MESSAGES/django.po +1 -1
  103. wagtail/locale/sl/LC_MESSAGES/django.mo +0 -0
  104. wagtail/locale/sl/LC_MESSAGES/django.po +77 -0
  105. wagtail/locale/sv/LC_MESSAGES/django.mo +0 -0
  106. wagtail/locale/sv/LC_MESSAGES/django.po +11 -2
  107. wagtail/locales/locale/it/LC_MESSAGES/django.mo +0 -0
  108. wagtail/locales/locale/it/LC_MESSAGES/django.po +16 -17
  109. wagtail/search/locale/fa/LC_MESSAGES/django.mo +0 -0
  110. wagtail/search/locale/fa/LC_MESSAGES/django.po +24 -0
  111. wagtail/search/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
  112. wagtail/search/locale/pt_BR/LC_MESSAGES/django.po +2 -2
  113. wagtail/search/tests/test_queries.py +24 -0
  114. wagtail/search/utils.py +6 -12
  115. wagtail/snippets/locale/fa/LC_MESSAGES/django.mo +0 -0
  116. wagtail/snippets/locale/fa/LC_MESSAGES/django.po +17 -1
  117. wagtail/snippets/locale/pt_BR/LC_MESSAGES/django.po +1 -1
  118. wagtail/snippets/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
  119. wagtail/snippets/locale/sk_SK/LC_MESSAGES/django.po +3 -0
  120. wagtail/snippets/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  121. wagtail/snippets/locale/zh_Hans/LC_MESSAGES/django.po +40 -1
  122. wagtail/test/testapp/templates/tests/icons/single-quotes.svg +1 -0
  123. wagtail/tests/test_blocks.py +27 -0
  124. wagtail/tests/test_utils.py +28 -1
  125. wagtail/users/locale/fa/LC_MESSAGES/django.mo +0 -0
  126. wagtail/users/locale/fa/LC_MESSAGES/django.po +63 -1
  127. wagtail/users/locale/fr/LC_MESSAGES/django.mo +0 -0
  128. wagtail/users/locale/fr/LC_MESSAGES/django.po +44 -3
  129. wagtail/users/locale/is_IS/LC_MESSAGES/django.mo +0 -0
  130. wagtail/users/locale/is_IS/LC_MESSAGES/django.po +44 -2
  131. wagtail/users/locale/pt_BR/LC_MESSAGES/django.po +1 -1
  132. wagtail/users/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
  133. wagtail/users/locale/sk_SK/LC_MESSAGES/django.po +8 -1
  134. wagtail/users/locale/sl/LC_MESSAGES/django.mo +0 -0
  135. wagtail/users/locale/sl/LC_MESSAGES/django.po +46 -2
  136. wagtail/users/locale/sv/LC_MESSAGES/django.mo +0 -0
  137. wagtail/users/locale/sv/LC_MESSAGES/django.po +41 -2
  138. wagtail/users/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  139. wagtail/users/locale/zh_Hans/LC_MESSAGES/django.po +45 -1
  140. wagtail/utils/utils.py +26 -0
  141. wagtail/widget_adapters.py +1 -1
  142. {wagtail-6.1.1.dist-info → wagtail-6.1.3.dist-info}/METADATA +1 -1
  143. {wagtail-6.1.1.dist-info → wagtail-6.1.3.dist-info}/RECORD +147 -145
  144. {wagtail-6.1.1.dist-info → wagtail-6.1.3.dist-info}/LICENSE +0 -0
  145. {wagtail-6.1.1.dist-info → wagtail-6.1.3.dist-info}/WHEEL +0 -0
  146. {wagtail-6.1.1.dist-info → wagtail-6.1.3.dist-info}/entry_points.txt +0 -0
  147. {wagtail-6.1.1.dist-info → wagtail-6.1.3.dist-info}/top_level.txt +0 -0
@@ -73,11 +73,6 @@ class BaseTestSiteSettingView(WagtailTestUtils, TestCase):
73
73
  class TestSiteSettingCreateView(BaseTestSiteSettingView):
74
74
  def setUp(self):
75
75
  self.user = self.login()
76
- self.user.user_permissions.add(
77
- Permission.objects.get(
78
- content_type__app_label="wagtailadmin", codename="access_admin"
79
- )
80
- )
81
76
 
82
77
  def test_get_edit(self):
83
78
  response = self.get()
@@ -109,11 +104,61 @@ class TestSiteSettingCreateView(BaseTestSiteSettingView):
109
104
  # Ensure the form supports file uploads
110
105
  self.assertContains(response, 'enctype="multipart/form-data"')
111
106
 
112
- def test_create_restricted_field_without_permission(self):
107
+ def test_create_restricted_field_without_any_permission(self):
108
+ # User has no permissions over the setting model, only access to the admin
109
+ self.user.is_superuser = False
110
+ self.user.save()
111
+ self.user.user_permissions.add(
112
+ Permission.objects.get(
113
+ content_type__app_label="wagtailadmin", codename="access_admin"
114
+ ),
115
+ )
116
+
117
+ self.assertFalse(TestPermissionedSiteSetting.objects.exists())
118
+ # GET should redirect away with permission denied
119
+ response = self.get(setting=TestPermissionedSiteSetting)
120
+ self.assertRedirects(response, status_code=302, expected_url="/admin/")
121
+
122
+ # the GET might create a setting object, depending on when the permission check is done,
123
+ # so remove any created objects prior to testing the POST
124
+
125
+ # POST should redirect away with permission denied
126
+ response = self.post(
127
+ post_data={"sensitive_email": "test@example.com", "title": "test"},
128
+ setting=TestPermissionedSiteSetting,
129
+ )
130
+ self.assertRedirects(response, status_code=302, expected_url="/admin/")
131
+
132
+ # The retrieved setting should contain none of the submitted data
133
+ settings = TestPermissionedSiteSetting.for_site(Site.objects.get(pk=1))
134
+ self.assertEqual(settings.title, "")
135
+ self.assertEqual(settings.sensitive_email, "")
136
+
137
+ def test_create_restricted_field_without_field_permission(self):
138
+ # User has edit permission over the setting model, but not the sensitive_email field
113
139
  self.user.is_superuser = False
114
140
  self.user.save()
141
+ self.user.user_permissions.add(
142
+ Permission.objects.get(
143
+ content_type__app_label="wagtailadmin", codename="access_admin"
144
+ ),
145
+ Permission.objects.get(
146
+ content_type__app_label="tests",
147
+ codename="change_testpermissionedsitesetting",
148
+ ),
149
+ )
115
150
 
116
151
  self.assertFalse(TestPermissionedSiteSetting.objects.exists())
152
+ # GET should provide a form with title but not sensitive_email
153
+ response = self.get(setting=TestPermissionedSiteSetting)
154
+ self.assertEqual(response.status_code, 200)
155
+ self.assertIn("title", list(response.context["form"].fields))
156
+ self.assertNotIn("sensitive_email", list(response.context["form"].fields))
157
+
158
+ # the GET creates a setting object, so remove any created objects prior to testing the POST
159
+ TestPermissionedSiteSetting.objects.all().delete()
160
+
161
+ # POST should allow the title to be set, but not the sensitive_email
117
162
  response = self.post(
118
163
  post_data={"sensitive_email": "test@example.com", "title": "test"},
119
164
  setting=TestPermissionedSiteSetting,
@@ -125,12 +170,30 @@ class TestSiteSettingCreateView(BaseTestSiteSettingView):
125
170
  self.assertEqual(settings.sensitive_email, "")
126
171
 
127
172
  def test_create_restricted_field(self):
173
+ # User has edit permission over the setting model, including the sensitive_email field
128
174
  self.user.is_superuser = False
129
175
  self.user.save()
130
176
  self.user.user_permissions.add(
131
- Permission.objects.get(codename="can_edit_sensitive_email_site_setting")
177
+ Permission.objects.get(
178
+ content_type__app_label="wagtailadmin", codename="access_admin"
179
+ ),
180
+ Permission.objects.get(
181
+ content_type__app_label="tests",
182
+ codename="change_testpermissionedsitesetting",
183
+ ),
184
+ Permission.objects.get(codename="can_edit_sensitive_email_site_setting"),
132
185
  )
133
186
  self.assertFalse(TestPermissionedSiteSetting.objects.exists())
187
+ # GET should provide a form with title and sensitive_email
188
+ response = self.get(setting=TestPermissionedSiteSetting)
189
+ self.assertEqual(response.status_code, 200)
190
+ self.assertIn("title", list(response.context["form"].fields))
191
+ self.assertIn("sensitive_email", list(response.context["form"].fields))
192
+
193
+ # the GET creates a setting object, so remove any created objects prior to testing the POST
194
+ TestPermissionedSiteSetting.objects.all().delete()
195
+
196
+ # POST should allow both title and sensitive_email to be set
134
197
  response = self.post(
135
198
  post_data={"sensitive_email": "test@example.com", "title": "test"},
136
199
  setting=TestPermissionedSiteSetting,
@@ -153,11 +216,6 @@ class TestSiteSettingEditView(BaseTestSiteSettingView):
153
216
  self.test_setting.save()
154
217
 
155
218
  self.user = self.login()
156
- self.user.user_permissions.add(
157
- Permission.objects.get(
158
- content_type__app_label="wagtailadmin", codename="access_admin"
159
- )
160
- )
161
219
 
162
220
  def test_get_edit(self):
163
221
  response = self.get()
@@ -211,50 +269,117 @@ class TestSiteSettingEditView(BaseTestSiteSettingView):
211
269
  self.assertRedirects(response, status_code=302, expected_url="/admin/")
212
270
 
213
271
  def test_edit_restricted_field(self):
272
+ # User has edit permission over the setting model, including the sensitive_email field
214
273
  test_setting = TestPermissionedSiteSetting()
274
+ test_setting.title = "Old title"
215
275
  test_setting.sensitive_email = "test@example.com"
216
276
  test_setting.site = self.default_site
217
277
  test_setting.save()
218
278
  self.user.is_superuser = False
219
279
  self.user.save()
220
-
221
280
  self.user.user_permissions.add(
222
- Permission.objects.get(codename="can_edit_sensitive_email_site_setting")
281
+ Permission.objects.get(
282
+ content_type__app_label="wagtailadmin", codename="access_admin"
283
+ ),
284
+ Permission.objects.get(
285
+ content_type__app_label="tests",
286
+ codename="change_testpermissionedsitesetting",
287
+ ),
288
+ Permission.objects.get(codename="can_edit_sensitive_email_site_setting"),
223
289
  )
224
290
 
291
+ # GET should provide a form with title and sensitive_email
225
292
  response = self.get(setting=TestPermissionedSiteSetting)
226
293
  self.assertEqual(response.status_code, 200)
294
+ self.assertIn("title", list(response.context["form"].fields))
227
295
  self.assertIn("sensitive_email", list(response.context["form"].fields))
228
296
 
297
+ # POST should allow both title and sensitive_email to be set
229
298
  response = self.post(
230
299
  setting=TestPermissionedSiteSetting,
231
- post_data={"sensitive_email": "test-updated@example.com", "title": "title"},
300
+ post_data={
301
+ "sensitive_email": "test-updated@example.com",
302
+ "title": "New title",
303
+ },
232
304
  )
233
305
  self.assertEqual(response.status_code, 302)
234
306
 
235
307
  test_setting.refresh_from_db()
236
308
  self.assertEqual(test_setting.sensitive_email, "test-updated@example.com")
309
+ self.assertEqual(test_setting.title, "New title")
237
310
 
238
- def test_edit_restricted_field_without_permission(self):
311
+ def test_edit_restricted_field_without_field_permission(self):
312
+ # User has edit permission over the setting model, but not the sensitive_email field
239
313
  test_setting = TestPermissionedSiteSetting()
314
+ test_setting.title = "Old title"
240
315
  test_setting.sensitive_email = "test@example.com"
241
316
  test_setting.site = self.default_site
242
317
  test_setting.save()
243
318
  self.user.is_superuser = False
244
319
  self.user.save()
320
+ self.user.user_permissions.add(
321
+ Permission.objects.get(
322
+ content_type__app_label="wagtailadmin", codename="access_admin"
323
+ ),
324
+ Permission.objects.get(
325
+ content_type__app_label="tests",
326
+ codename="change_testpermissionedsitesetting",
327
+ ),
328
+ )
245
329
 
330
+ # GET should provide a form with title but not sensitive_email
246
331
  response = self.get(setting=TestPermissionedSiteSetting)
247
332
  self.assertEqual(response.status_code, 200)
333
+ self.assertIn("title", list(response.context["form"].fields))
248
334
  self.assertNotIn("sensitive_email", list(response.context["form"].fields))
249
335
 
336
+ # POST should allow the title to be set, but not the sensitive_email
250
337
  response = self.post(
251
338
  setting=TestPermissionedSiteSetting,
252
- post_data={"sensitive_email": "test-updated@example.com", "title": "title"},
339
+ post_data={
340
+ "sensitive_email": "test-updated@example.com",
341
+ "title": "New title",
342
+ },
253
343
  )
254
344
  self.assertEqual(response.status_code, 302)
255
345
 
256
346
  test_setting.refresh_from_db()
257
347
  self.assertEqual(test_setting.sensitive_email, "test@example.com")
348
+ self.assertEqual(test_setting.title, "New title")
349
+
350
+ def test_edit_restricted_field_without_any_permission(self):
351
+ # User has no permissions over the setting model, only access to the admin
352
+ test_setting = TestPermissionedSiteSetting()
353
+ test_setting.title = "Old title"
354
+ test_setting.sensitive_email = "test@example.com"
355
+ test_setting.site = self.default_site
356
+ test_setting.save()
357
+ self.user.is_superuser = False
358
+ self.user.save()
359
+ self.user.user_permissions.add(
360
+ Permission.objects.get(
361
+ content_type__app_label="wagtailadmin", codename="access_admin"
362
+ ),
363
+ )
364
+
365
+ # GET should redirect away with permission denied
366
+ response = self.get(setting=TestPermissionedSiteSetting)
367
+ self.assertRedirects(response, status_code=302, expected_url="/admin/")
368
+
369
+ # POST should redirect away with permission denied
370
+ response = self.post(
371
+ setting=TestPermissionedSiteSetting,
372
+ post_data={
373
+ "sensitive_email": "test-updated@example.com",
374
+ "title": "New title",
375
+ },
376
+ )
377
+ self.assertRedirects(response, status_code=302, expected_url="/admin/")
378
+
379
+ # The retrieved setting should be unchanged
380
+ test_setting.refresh_from_db()
381
+ self.assertEqual(test_setting.sensitive_email, "test@example.com")
382
+ self.assertEqual(test_setting.title, "Old title")
258
383
 
259
384
 
260
385
  @override_settings(
@@ -14,6 +14,7 @@ from wagtail.admin.panels import (
14
14
  )
15
15
  from wagtail.admin.views import generic
16
16
  from wagtail.models import Site
17
+ from wagtail.permission_policies import ModelPermissionPolicy
17
18
 
18
19
  from .forms import SiteSwitchForm
19
20
  from .models import BaseGenericSetting, BaseSiteSetting
@@ -81,11 +82,13 @@ def redirect_to_relevant_instance(request, app_name, model_name):
81
82
  class EditView(generic.EditView):
82
83
  template_name = "wagtailsettings/edit.html"
83
84
  error_message = gettext_lazy("The setting could not be saved due to errors.")
85
+ permission_required = "change"
84
86
 
85
87
  def setup(self, request, app_name, model_name, *args, **kwargs):
86
88
  self.app_name = app_name
87
89
  self.model_name = model_name
88
90
  self.model = get_model_from_url_params(app_name, model_name)
91
+ self.permission_policy = ModelPermissionPolicy(self.model)
89
92
  self.pk = kwargs.get(self.pk_url_kwarg)
90
93
  super().setup(request, app_name, model_name, *args, **kwargs)
91
94
 
@@ -5,7 +5,7 @@
5
5
  #
6
6
  # Translators:
7
7
  # Ed Wurch <ewurch@gmail.com>, 2021
8
- # Rodrigo de Almeida Sottomaior Macedo <sottomaiormacedotec@gmail.com>, 2021
8
+ # Rodrigo de Almeida Sottomaior Macedo <sottomaiormacedotec@sottomaiormacedo.tech>, 2021
9
9
  # Iuri L. Machado, 2022
10
10
  # Loic Teixeira, 2022
11
11
  # Luiz Boaretto <lboaretto@gmail.com>, 2024
@@ -4,6 +4,7 @@
4
4
  #
5
5
  # Translators:
6
6
  # dellax <michalnebbia@gmail.com>, 2015
7
+ # Ivan Waginger <ivan.waginger@gmail.com>, 2024
7
8
  # karabellyj <jozefkarabelly@gmail.com>, 2017
8
9
  # karabellyj <jozefkarabelly@gmail.com>, 2017
9
10
  # Martin Janšto <mato@jansto.sk>, 2017
@@ -15,7 +16,7 @@ msgstr ""
15
16
  "Report-Msgid-Bugs-To: \n"
16
17
  "POT-Creation-Date: 2024-05-02 10:04+0100\n"
17
18
  "PO-Revision-Date: 2015-08-26 14:07+0000\n"
18
- "Last-Translator: dellax <michalnebbia@gmail.com>, 2015\n"
19
+ "Last-Translator: Ivan Waginger <ivan.waginger@gmail.com>, 2024\n"
19
20
  "Language-Team: Slovak (Slovakia) (http://app.transifex.com/torchbox/wagtail/"
20
21
  "language/sk_SK/)\n"
21
22
  "MIME-Version: 1.0\n"
@@ -25,6 +26,9 @@ msgstr ""
25
26
  "Plural-Forms: nplurals=4; plural=(n % 1 == 0 && n == 1 ? 0 : n % 1 == 0 && n "
26
27
  ">= 2 && n <= 4 ? 1 : n % 1 != 0 ? 2: 3);\n"
27
28
 
29
+ msgid "Minimap"
30
+ msgstr "Minimapa"
31
+
28
32
  msgid "Save"
29
33
  msgstr "Uložiť"
30
34
 
@@ -25,6 +25,9 @@ msgstr ""
25
25
  msgid "Wagtail style guide"
26
26
  msgstr "Wagtail 风格指南"
27
27
 
28
+ msgid "Minimap"
29
+ msgstr "小地图"
30
+
28
31
  msgid "Save"
29
32
  msgstr "保存"
30
33
 
@@ -21,3 +21,36 @@ class TestStyleGuide(WagtailTestUtils, TestCase):
21
21
  self.assertContains(response, custom_css)
22
22
  self.assertContains(response, widget_css)
23
23
  self.assertContains(response, widget_js)
24
+
25
+ def test_icons(self):
26
+ def register_icons(icons):
27
+ return icons + [
28
+ "tests/icons/single-quotes.svg", # id='icon-single-quotes'
29
+ ]
30
+
31
+ with self.register_hook("register_icons", register_icons):
32
+ response = self.client.get(reverse("wagtailstyleguide"))
33
+
34
+ self.assertEqual(response.status_code, 200)
35
+ # Should render the icons in the table
36
+ self.assertContains(
37
+ response,
38
+ '<use href="#icon-single-quotes"></use>',
39
+ html=True,
40
+ )
41
+ self.assertContains(
42
+ response,
43
+ "<td>Custom icon with single quotes for the id</td>",
44
+ html=True,
45
+ )
46
+ # Built-in icon, not from the above hook
47
+ self.assertContains(
48
+ response,
49
+ '<use href="#icon-h1"></use>',
50
+ html=True,
51
+ )
52
+ self.assertContains(
53
+ response,
54
+ "<td>Custom icon</td>",
55
+ html=True,
56
+ )
@@ -101,7 +101,10 @@ class ExampleForm(forms.Form):
101
101
  )
102
102
 
103
103
 
104
- icon_id_pattern = re.compile(r"id=\"icon-([a-z0-9-]+)\"")
104
+ # Allow single and double quotes for the ID.
105
+ # For simplicity and readability, we don't enforce the opening
106
+ # and closing quotes to match.
107
+ icon_id_pattern = re.compile(r"""id=["']icon-([a-z0-9-]+)["']""")
105
108
  icon_comment_pattern = re.compile(r"<!--!(.*?)-->")
106
109
 
107
110
 
@@ -6,13 +6,14 @@
6
6
  # Bertrand Bordage <bordage.bertrand@gmail.com>, 2018
7
7
  # Léo <leo@naeka.fr>, 2016
8
8
  # Loic Teixeira, 2020-2021
9
+ # Sébastien Corbin <seb.corbin@gmail.com>, 2024
9
10
  msgid ""
10
11
  msgstr ""
11
12
  "Project-Id-Version: Wagtail\n"
12
13
  "Report-Msgid-Bugs-To: \n"
13
14
  "POT-Creation-Date: 2024-05-02 10:04+0100\n"
14
15
  "PO-Revision-Date: 2016-05-11 20:23+0000\n"
15
- "Last-Translator: Léo <leo@naeka.fr>, 2016\n"
16
+ "Last-Translator: Sébastien Corbin <seb.corbin@gmail.com>, 2024\n"
16
17
  "Language-Team: French (http://app.transifex.com/torchbox/wagtail/language/"
17
18
  "fr/)\n"
18
19
  "MIME-Version: 1.0\n"
@@ -28,11 +29,36 @@ msgstr "Bloc « tableau » Wagtail"
28
29
  msgid "Row header"
29
30
  msgstr "Ligne d'en-tête"
30
31
 
32
+ msgid "Table headers"
33
+ msgstr "Entêtes de tableau"
34
+
35
+ msgid "Display the first row as a header"
36
+ msgstr "Afficher la première ligne en tant qu'entête"
37
+
38
+ msgid "Display the first column as a header"
39
+ msgstr "Afficher la première colonne en tant qu'entête"
40
+
31
41
  msgid "Column header"
32
42
  msgstr "Colonne d'en-tête"
33
43
 
44
+ msgid "Display the first row AND first column as headers"
45
+ msgstr "Afficher la première ligne ET la première colonne en tant qu'entêtes"
46
+
47
+ msgid "No headers"
48
+ msgstr "Aucun entête"
49
+
50
+ msgid "Which cells should be displayed as headers?"
51
+ msgstr "Quelles cellules devraient être affichées comme entête ?"
52
+
34
53
  msgid "Table caption"
35
54
  msgstr "Légende"
36
55
 
56
+ msgid ""
57
+ "A heading that identifies the overall topic of the table, and is useful for "
58
+ "screen reader users."
59
+ msgstr ""
60
+ "Un titre qui identifie le sujet général du tableau, et qui sera utile pour "
61
+ "les utilisateurs de lecteur d'écran."
62
+
37
63
  msgid "Table"
38
64
  msgstr "Tableau"
@@ -3,7 +3,7 @@
3
3
  # This file is distributed under the same license as the PACKAGE package.
4
4
  #
5
5
  # Translators:
6
- # Arnar Tumi Þorsteinsson <arnartumi@gmail.com>, 2016,2021
6
+ # Arnar Tumi Þorsteinsson <arnartumi@gmail.com>, 2016,2021,2024
7
7
  # saevarom <saevar@saevar.is>, 2018,2020
8
8
  # saevarom <saevar@saevar.is>, 2018,2020
9
9
  msgid ""
@@ -12,7 +12,8 @@ msgstr ""
12
12
  "Report-Msgid-Bugs-To: \n"
13
13
  "POT-Creation-Date: 2024-05-02 10:04+0100\n"
14
14
  "PO-Revision-Date: 2016-05-11 20:23+0000\n"
15
- "Last-Translator: saevarom <saevar@saevar.is>, 2018,2020\n"
15
+ "Last-Translator: Arnar Tumi Þorsteinsson <arnartumi@gmail.com>, "
16
+ "2016,2021,2024\n"
16
17
  "Language-Team: Icelandic (Iceland) (http://app.transifex.com/torchbox/"
17
18
  "wagtail/language/is_IS/)\n"
18
19
  "MIME-Version: 1.0\n"
@@ -27,11 +28,36 @@ msgstr "Wagtail töflu blokk"
27
28
  msgid "Row header"
28
29
  msgstr "Töfluhaus"
29
30
 
31
+ msgid "Table headers"
32
+ msgstr "Töfluhaus"
33
+
34
+ msgid "Display the first row as a header"
35
+ msgstr "Birta fyrstu röð sem töfluhaus"
36
+
37
+ msgid "Display the first column as a header"
38
+ msgstr "Birta fyrsta dálk sem fyrirsagnadálk"
39
+
30
40
  msgid "Column header"
31
41
  msgstr "Fyrirsagnadálkur"
32
42
 
43
+ msgid "Display the first row AND first column as headers"
44
+ msgstr "Birta fyrstu röð OG fyrsta dálk sem töfluhaus/fyrirsagnadálk"
45
+
46
+ msgid "No headers"
47
+ msgstr "Enginn haus"
48
+
49
+ msgid "Which cells should be displayed as headers?"
50
+ msgstr "Hvaða reitir eiga að birtast sem fyrirsagnareitir?"
51
+
33
52
  msgid "Table caption"
34
53
  msgstr "Töflufyrirsögn"
35
54
 
55
+ msgid ""
56
+ "A heading that identifies the overall topic of the table, and is useful for "
57
+ "screen reader users."
58
+ msgstr ""
59
+ "Fyrirsögn sem lýsir almennu innihaldi töflunnar, og er gagnleg fyrir "
60
+ "notendur skjálesara"
61
+
36
62
  msgid "Table"
37
63
  msgstr "Tafla"
@@ -5,13 +5,14 @@
5
5
  # Translators:
6
6
  # Andrej Marsetič, 2022
7
7
  # Andrej Marsetič, 2022
8
+ # Andrej Marsetič, 2024
8
9
  msgid ""
9
10
  msgstr ""
10
11
  "Project-Id-Version: Wagtail\n"
11
12
  "Report-Msgid-Bugs-To: \n"
12
13
  "POT-Creation-Date: 2024-05-02 10:04+0100\n"
13
14
  "PO-Revision-Date: 2016-05-11 20:23+0000\n"
14
- "Last-Translator: Andrej Marsetič, 2022\n"
15
+ "Last-Translator: Andrej Marsetič, 2024\n"
15
16
  "Language-Team: Slovenian (http://app.transifex.com/torchbox/wagtail/language/"
16
17
  "sl/)\n"
17
18
  "MIME-Version: 1.0\n"
@@ -27,11 +28,36 @@ msgstr "Wagtail Namizni blok"
27
28
  msgid "Row header"
28
29
  msgstr "Naslov vrstice"
29
30
 
31
+ msgid "Table headers"
32
+ msgstr "Naslovi tabel"
33
+
34
+ msgid "Display the first row as a header"
35
+ msgstr "Prikaži prvo vrstico kot glavo"
36
+
37
+ msgid "Display the first column as a header"
38
+ msgstr "Prikaži prvi stolpec kot glavo"
39
+
30
40
  msgid "Column header"
31
41
  msgstr "Glava stolpca"
32
42
 
43
+ msgid "Display the first row AND first column as headers"
44
+ msgstr "Prikažite prvo vrstico IN prvi stolpec kot glave"
45
+
46
+ msgid "No headers"
47
+ msgstr "Brez glave"
48
+
49
+ msgid "Which cells should be displayed as headers?"
50
+ msgstr "Katere celice naj se prikažejo kot glave?"
51
+
33
52
  msgid "Table caption"
34
53
  msgstr "Napis tabele"
35
54
 
55
+ msgid ""
56
+ "A heading that identifies the overall topic of the table, and is useful for "
57
+ "screen reader users."
58
+ msgstr ""
59
+ "Naslov, ki označuje splošno temo tabele in je uporaben za uporabnike "
60
+ "bralnikov zaslona."
61
+
36
62
  msgid "Table"
37
63
  msgstr "Tabela"
@@ -5,6 +5,7 @@
5
5
  #
6
6
  # Translators:
7
7
  # Renaud Kern <renaud.kern@gmail.com>, 2021
8
+ # Sébastien Corbin <seb.corbin@gmail.com>, 2024
8
9
  #
9
10
  #, fuzzy
10
11
  msgid ""
@@ -13,7 +14,7 @@ msgstr ""
13
14
  "Report-Msgid-Bugs-To: \n"
14
15
  "POT-Creation-Date: 2024-05-02 10:04+0100\n"
15
16
  "PO-Revision-Date: 2021-10-15 16:05+0000\n"
16
- "Last-Translator: Renaud Kern <renaud.kern@gmail.com>, 2021\n"
17
+ "Last-Translator: Sébastien Corbin <seb.corbin@gmail.com>, 2024\n"
17
18
  "Language-Team: French (https://app.transifex.com/torchbox/teams/8009/fr/)\n"
18
19
  "MIME-Version: 1.0\n"
19
20
  "Content-Type: text/plain; charset=UTF-8\n"
@@ -22,6 +23,16 @@ msgstr ""
22
23
  "Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % "
23
24
  "1000000 == 0 ? 1 : 2;\n"
24
25
 
26
+ msgid "Caption"
27
+ msgstr "Légende"
28
+
29
+ msgid ""
30
+ "A heading that identifies the overall topic of the table, and is useful for "
31
+ "screen reader users."
32
+ msgstr ""
33
+ "Un titre qui identifie le sujet général du tableau, et qui sera utile pour "
34
+ "les utilisateurs de lecteur d'écran."
35
+
25
36
  msgid "Add column"
26
37
  msgstr "Ajouter une colonne"
27
38
 
@@ -5,6 +5,7 @@
5
5
  #
6
6
  # Translators:
7
7
  # saevarom <saevar@saevar.is>, 2021
8
+ # Arnar Tumi Þorsteinsson <arnartumi@gmail.com>, 2024
8
9
  #
9
10
  #, fuzzy
10
11
  msgid ""
@@ -13,7 +14,7 @@ msgstr ""
13
14
  "Report-Msgid-Bugs-To: \n"
14
15
  "POT-Creation-Date: 2024-05-02 10:04+0100\n"
15
16
  "PO-Revision-Date: 2021-10-15 16:05+0000\n"
16
- "Last-Translator: saevarom <saevar@saevar.is>, 2021\n"
17
+ "Last-Translator: Arnar Tumi Þorsteinsson <arnartumi@gmail.com>, 2024\n"
17
18
  "Language-Team: Icelandic (Iceland) (https://app.transifex.com/torchbox/"
18
19
  "teams/8009/is_IS/)\n"
19
20
  "MIME-Version: 1.0\n"
@@ -22,6 +23,16 @@ msgstr ""
22
23
  "Language: is_IS\n"
23
24
  "Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n"
24
25
 
26
+ msgid "Caption"
27
+ msgstr "Fyrirsögn"
28
+
29
+ msgid ""
30
+ "A heading that identifies the overall topic of the table, and is useful for "
31
+ "screen reader users."
32
+ msgstr ""
33
+ "Fyrirsögn sem lýsir almennu innihaldi töflunnar, og er gagnleg fyrir "
34
+ "notendur skjálesara"
35
+
25
36
  msgid "Add column"
26
37
  msgstr "Nýr dálkur"
27
38
 
@@ -4,7 +4,7 @@
4
4
  # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
5
  #
6
6
  # Translators:
7
- # Rodrigo de Almeida Sottomaior Macedo <sottomaiormacedotec@gmail.com>, 2021
7
+ # Rodrigo de Almeida Sottomaior Macedo <sottomaiormacedotec@sottomaiormacedo.tech>, 2021
8
8
  # Luiz Boaretto <lboaretto@gmail.com>, 2024
9
9
  #
10
10
  #, fuzzy
@@ -4,7 +4,7 @@
4
4
  # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
5
  #
6
6
  # Translators:
7
- # Andrej Marsetič, 2022
7
+ # Andrej Marsetič, 2024
8
8
  #
9
9
  #, fuzzy
10
10
  msgid ""
@@ -13,7 +13,7 @@ msgstr ""
13
13
  "Report-Msgid-Bugs-To: \n"
14
14
  "POT-Creation-Date: 2024-05-02 10:04+0100\n"
15
15
  "PO-Revision-Date: 2021-10-15 16:05+0000\n"
16
- "Last-Translator: Andrej Marsetič, 2022\n"
16
+ "Last-Translator: Andrej Marsetič, 2024\n"
17
17
  "Language-Team: Slovenian (https://app.transifex.com/torchbox/teams/8009/"
18
18
  "sl/)\n"
19
19
  "MIME-Version: 1.0\n"
@@ -23,6 +23,16 @@ msgstr ""
23
23
  "Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || "
24
24
  "n%100==4 ? 2 : 3);\n"
25
25
 
26
+ msgid "Caption"
27
+ msgstr "Napis"
28
+
29
+ msgid ""
30
+ "A heading that identifies the overall topic of the table, and is useful for "
31
+ "screen reader users."
32
+ msgstr ""
33
+ "Naslov, ki označuje splošno temo tabele in je uporaben za uporabnike "
34
+ "bralnikov zaslona."
35
+
26
36
  msgid "Add column"
27
37
  msgstr "Dodaj stolpec"
28
38