Reinstate default_ordering to search promotions IndexView

pull/11661/head
Sage Abdullah 2024-02-29 17:28:56 +00:00
rodzic 1a7230ea21
commit 93c4a89b33
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: EB1A33CC51CC0217
2 zmienionych plików z 9 dodań i 0 usunięć

Wyświetl plik

@ -296,6 +296,13 @@ class TestSearchPromotionsIndexView(WagtailTestUtils, TestCase):
sort_order=0,
description="ooh, it's a snake",
)
# Add another one to make sure it's not ordered descending by pk
SearchPromotion.objects.create(
query=Query.get("beloved snake"),
page_id=1,
sort_order=0,
description="beloved snake goes ssSSSS",
)
response = self.client.get(reverse("wagtailsearchpromotions:index"))
@ -305,6 +312,7 @@ class TestSearchPromotionsIndexView(WagtailTestUtils, TestCase):
# "aargh snake" should be the first result alphabetically
self.assertEqual(response.context["queries"][0].query_string, "aaargh snake")
self.assertEqual(response.context["queries"][1].query_string, "beloved snake")
def test_multiple_searchpromotions(self):
today = date.today()

Wyświetl plik

@ -38,6 +38,7 @@ class IndexView(generic.IndexView):
index_results_url_name = "wagtailsearchpromotions:index_results"
_show_breadcrumbs = True
search_fields = ["query_string"]
default_ordering = "query_string"
add_url_name = "wagtailsearchpromotions:add"
add_item_label = gettext_lazy("Add new promoted result")
columns = [