Release note for #8302 in 2.16.2

pull/9096/head
Matt Westcott 2022-04-07 14:25:28 +01:00
rodzic a46b4e59e5
commit 03dafa8b1b
5 zmienionych plików z 54 dodań i 2 usunięć

Wyświetl plik

@ -12,6 +12,7 @@ Changelog
* Fix: Page copy in Wagtail admin ignores `exclude_fields_in_copy` (John-Scott Atlakson)
* Fix: Translation key `IntegrityError` when publishing pages with translatable `Orderable`s that were copied without being published (Kalob Taulien, Dan Braghis)
* Fix: Ignore `GenericRelation` when copying pages (John-Scott Atlakson)
* Fix: Ensure 'next' links from image / document listings do not redirect back to partial AJAX view (Matt Westcott)
2.16.1 (11.02.2022)

Wyświetl plik

@ -131,6 +131,25 @@ class TestDocumentIndexView(TestCase, WagtailTestUtils):
self.assertContains(response, '%s?next=%s' % (edit_url, next_url))
class TestDocumentListingResultsView(TestCase, WagtailTestUtils):
def setUp(self):
self.login()
def get(self, params={}):
return self.client.get(reverse("wagtaildocs:listing_results"), params)
def test_search(self):
doc = models.Document.objects.create(title="A boring report")
response = self.get({"q": "boring"})
self.assertEqual(response.status_code, 200)
# 'next' param on edit page link should point back to the documents index, not the results view
self.assertContains(
response,
"/admin/documents/edit/%d/?next=/admin/documents/%%3Fq%%3Dboring" % doc.id,
)
class TestDocumentAddView(TestCase, WagtailTestUtils):
def setUp(self):
self.login()

Wyświetl plik

@ -69,12 +69,17 @@ class BaseListingView(TemplateView):
paginator = Paginator(documents, per_page=20)
documents = paginator.get_page(self.request.GET.get('p'))
next_url = reverse("wagtaildocs:index")
request_query_string = self.request.META.get("QUERY_STRING")
if request_query_string:
next_url += "?" + request_query_string
context.update({
'ordering': ordering,
'documents': documents,
'query_string': query_string,
'is_searching': bool(query_string),
'next': self.request.get_full_path(),
'next': next_url,
})
return context

Wyświetl plik

@ -196,6 +196,28 @@ class TestImageIndexView(TestCase, WagtailTestUtils):
)
class TestImageListingResultsView(TestCase, WagtailTestUtils):
def setUp(self):
self.login()
def get(self, params={}):
return self.client.get(reverse("wagtailimages:listing_results"), params)
def test_search(self):
monster = Image.objects.create(
title="A scary monster",
file=get_test_image_file(),
)
response = self.get({"q": "monster"})
self.assertEqual(response.status_code, 200)
# 'next' param on edit page link should point back to the images index, not the results view
self.assertContains(
response,
"/admin/images/%d/?next=/admin/images/%%3Fq%%3Dmonster" % monster.id,
)
class TestImageAddView(TestCase, WagtailTestUtils):
def setUp(self):
self.login()

Wyświetl plik

@ -79,11 +79,16 @@ class BaseListingView(TemplateView):
paginator = Paginator(images, per_page=INDEX_PAGE_SIZE)
images = paginator.get_page(self.request.GET.get('p'))
next_url = reverse("wagtailimages:index")
request_query_string = self.request.META.get("QUERY_STRING")
if request_query_string:
next_url += "?" + request_query_string
context.update({
'images': images,
'query_string': query_string,
'is_searching': bool(query_string),
'next': self.request.get_full_path(),
'next': next_url,
})
return context