kopia lustrzana https://github.com/wagtail/wagtail
Sort groups by name in group index view
rodzic
3732bc6eb4
commit
20fde5ac66
|
|
@ -19,7 +19,7 @@ Changelog
|
|||
* Remove `wagtail.unpublish` log action on aliases when source page is unpublished (Dan Braghis)
|
||||
* Add compare buttons to workflow dashboard panel (Matt Westcott)
|
||||
* Add the ability to use filters and to export listings in generic `IndexView` (Sage Abdullah)
|
||||
* Move `list_filter`, `filterset_class`, `search_fields`, `search_backend_name`, `list_export`, `export_filename`, `list_per_page`, and `ordering` from `SnippetViewSet` to `ModelViewSet` (Sage Abdullah)
|
||||
* Move `list_filter`, `filterset_class`, `search_fields`, `search_backend_name`, `list_export`, `export_filename`, `list_per_page`, and `ordering` from `SnippetViewSet` to `ModelViewSet` (Sage Abdullah, Cynthia Kiser)
|
||||
* Add default header titles to generic `IndexView` and `CreateView` (Sage Abdullah)
|
||||
* Allow overriding `IndexView.export_headings` via `ModelViewSet` (Christer Jensen, Sage Abdullah)
|
||||
* Support specifying a `get_object_list` method on `ChooserViewSet` (Matt Westcott)
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ A number of features from {class}`~wagtail.snippets.views.snippets.SnippetViewSe
|
|||
* Move `SnippetViewSet` menu registration mechanism to base `ViewSet` class (Sage Abdullah)
|
||||
* Move `SnippetViewSet` template override mechanism to `ModelViewSet` (Sage Abdullah)
|
||||
* Move `SnippetViewSet.list_display` to `ModelViewSet` (Sage Abdullah)
|
||||
* Move `list_filter`, `filterset_class`, `search_fields`, `search_backend_name`, `list_export`, `export_filename`, `list_per_page`, and `ordering` from `SnippetViewSet` to `ModelViewSet` (Sage Abdullah)
|
||||
* Move `list_filter`, `filterset_class`, `search_fields`, `search_backend_name`, `list_export`, `export_filename`, `list_per_page`, and `ordering` from `SnippetViewSet` to `ModelViewSet` (Sage Abdullah, Cynthia Kiser)
|
||||
* Add default header titles to generic `IndexView` and `CreateView` (Sage Abdullah)
|
||||
* Add the ability to use filters and to export listings in generic `IndexView` (Sage Abdullah)
|
||||
* Add generic `UsageView` to `ModelViewSet` (Sage Abdullah)
|
||||
|
|
|
|||
|
|
@ -1347,6 +1347,15 @@ class TestGroupIndexView(AdminTemplateTestUtils, WagtailTestUtils, TestCase):
|
|||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.context["search_form"]["q"].value(), "Hello")
|
||||
|
||||
def test_default_ordering(self):
|
||||
# This group should display after the default groups but will display
|
||||
# before them if default_ordering is lost.
|
||||
Group.objects.create(name="Photographers")
|
||||
response = self.get()
|
||||
# groups should be returned in alpha order by name
|
||||
names = [group.name for group in response.context_data["object_list"]]
|
||||
self.assertEqual(names, ["Editors", "Moderators", "Photographers"])
|
||||
|
||||
|
||||
class TestGroupIndexResultsView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
|
|
|
|||
|
|
@ -59,8 +59,6 @@ class IndexView(generic.IndexView):
|
|||
search_fields = ["name"]
|
||||
context_object_name = "groups"
|
||||
paginate_by = 20
|
||||
ordering = ["name"]
|
||||
default_ordering = "name"
|
||||
|
||||
columns = [
|
||||
TitleColumn(
|
||||
|
|
@ -157,6 +155,7 @@ class DeleteView(generic.DeleteView):
|
|||
class GroupViewSet(ModelViewSet):
|
||||
icon = "group"
|
||||
model = Group
|
||||
ordering = ["name"]
|
||||
add_to_reference_index = False
|
||||
_show_breadcrumbs = False
|
||||
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue