kopia lustrzana https://github.com/wagtail/wagtail
Fix crash when accessing the history view for a translatable snippet
Regression in dc049cd880
.
pull/11234/head
rodzic
5cf37f3a9d
commit
1a4595b60b
|
@ -9,6 +9,7 @@ Changelog
|
|||
* Fix: Ensure text only email notifications for updated comments do not escape HTML characters (Rohit Sharma)
|
||||
* Fix: Use logical OR operator to combine search fields for Django ORM in generic IndexView (Varun Kumar)
|
||||
* Fix: Ensure that explorer_results views fill in the correct next_url parameter on action URLs (Matt Westcott)
|
||||
* Fix: Fix crash when accessing the history view for a translatable snippet (Sage Abdullah)
|
||||
* Docs: Fix code example for `{% picture ... as ... %}` template tag (Rezyapkin)
|
||||
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ depth: 1
|
|||
* Ensure text only email notifications for updated comments do not escape HTML characters (Rohit Sharma)
|
||||
* Use logical OR operator to combine search fields for Django ORM in generic IndexView (Varun Kumar)
|
||||
* Ensure that explorer_results views fill in the correct next_url parameter on action URLs (Matt Westcott)
|
||||
* Fix crash when accessing the history view for a translatable snippet (Sage Abdullah)
|
||||
|
||||
### Documentation
|
||||
|
||||
|
|
|
@ -228,7 +228,10 @@ class IndexView(
|
|||
|
||||
self.filters, queryset = self.filter_queryset(queryset)
|
||||
|
||||
if self.locale:
|
||||
# Ensure the queryset is of the same model as self.model before filtering,
|
||||
# which may not be the case for views like HistoryView where the queryset
|
||||
# is of a LogEntry model for self.model.
|
||||
if self.locale and queryset.model == self.model:
|
||||
queryset = queryset.filter(locale=self.locale)
|
||||
|
||||
has_updated_at_column = any(
|
||||
|
|
|
@ -61,6 +61,7 @@ from wagtail.test.testapp.models import (
|
|||
AdvertWithTabbedInterface,
|
||||
DraftStateCustomPrimaryKeyModel,
|
||||
DraftStateModel,
|
||||
FullFeaturedSnippet,
|
||||
MultiPreviewModesModel,
|
||||
RevisableChildModel,
|
||||
RevisableModel,
|
||||
|
@ -4117,10 +4118,10 @@ class TestSnippetHistory(WagtailTestUtils, TestCase):
|
|||
timestamp=make_aware(datetime.datetime(2022, 5, 10, 12, 34, 0)),
|
||||
object_id="1",
|
||||
)
|
||||
self.revisable_snippet = RevisableModel.objects.create(text="Foo")
|
||||
self.revisable_snippet = FullFeaturedSnippet.objects.create(text="Foo")
|
||||
self.initial_revision = self.revisable_snippet.save_revision(user=self.user)
|
||||
ModelLogEntry.objects.create(
|
||||
content_type=ContentType.objects.get_for_model(RevisableModel),
|
||||
content_type=ContentType.objects.get_for_model(FullFeaturedSnippet),
|
||||
label="Foo",
|
||||
action="wagtail.create",
|
||||
timestamp=make_aware(datetime.datetime(2022, 5, 10, 20, 22, 0)),
|
||||
|
@ -4227,6 +4228,8 @@ class TestSnippetHistory(WagtailTestUtils, TestCase):
|
|||
def test_get_with_i18n_enabled(self):
|
||||
response = self.get(self.non_revisable_snippet)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
response = self.get(self.revisable_snippet)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
|
||||
class TestSnippetRevisions(WagtailTestUtils, TestCase):
|
||||
|
|
Ładowanie…
Reference in New Issue