kopia lustrzana https://github.com/wagtail/wagtail
Reinstate default_ordering to search promotions IndexView
rodzic
1a7230ea21
commit
93c4a89b33
|
@ -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()
|
||||
|
|
|
@ -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 = [
|
||||
|
|
Ładowanie…
Reference in New Issue