Repository: wagtail/wagtail
File: wagtail/admin/views/generic/chooser.py (Python)

Code before:

        if self.construct_queryset_hook_name:
            # allow hooks to modify the queryset
            for hook in hooks.get_hooks(self.construct_queryset_hook_name):
                objects = hook(objects, self.request)

        if self.filter_form.is_valid():
            objects = self.filter_form.filter(objects)
        return objects

    def get_results_url(self):
        return self.append_preserved_url_parameters(reverse(self.results_url_name))

    def get_chosen_multiple_url(self):
        return self.append_preserved_url_parameters(
            reverse(self.chosen_multiple_url_name)
        )

    @cached_property
    def is_multiple_choice(self):
        return self.request.GET.get("multiple")

    @property
    def columns(self) -> list[Column]:
        if self.i18n_enabled:
            return [self.title_column, LocaleColumn()]
        return [self.title_column]

    @property
    def title_column(self):
        if self.is_multiple_choice:
            return TitleColumn(
                "title",
                label=_("Title"),
                accessor=str,
                label_prefix="chooser-modal-select",
            )
        else:
            return TitleColumn(
                "title",
                label=_("Title"),
                accessor=str,
                get_url=(
                    lambda obj: self.append_preserved_url_parameters(
                        reverse(self.chosen_url_name, args=(quote(obj.pk),))
                    )
                ),
                link_attrs={"data-chooser-modal-choice": True},
            )

    @property

Review comment (suggestion):
Not sure if we've ever had ordering working in choosers before (it needs the link to be AJAX-ified). If not, then we need to disable it

```suggestion
            return [self.title_column, LocaleColumn(sort_key=None)]
```

Code after:
        if filters:
            objects = objects.filter(**filters)

        if self.construct_queryset_hook_name:
            # allow hooks to modify the queryset
            for hook in hooks.get_hooks(self.construct_queryset_hook_name):
                objects = hook(objects, self.request)

        if self.filter_form.is_valid():
            objects = self.filter_form.filter(objects)
        return objects

    def get_results_url(self):
        return self.append_preserved_url_parameters(reverse(self.results_url_name))

    def get_chosen_multiple_url(self):
        return self.append_preserved_url_parameters(
            reverse(self.chosen_multiple_url_name)
        )

    @cached_property
    def is_multiple_choice(self):
        return self.request.GET.get("multiple")

    @property
    def columns(self) -> list[Column]:
        columns = [self.title_column]
        if self.i18n_enabled:
            columns.append(LocaleColumn(sort_key=None))
        return columns

    @property
    def title_column(self):
        if self.is_multiple_choice:
            return TitleColumn(
                "title",
                label=_("Title"),
                accessor=str,
                label_prefix="chooser-modal-select",
            )
        else:
            return TitleColumn(
                "title",
                label=_("Title"),
                accessor=str,
                get_url=(
                    lambda obj: self.append_preserved_url_parameters(
                        reverse(self.chosen_url_name, args=(quote(obj.pk),))
                    )
                ),
                link_attrs={"data-chooser-modal-choice": True},