-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically generate filterset_class
for snippets and generic IndexView
through list_filter
#10256
Conversation
Manage this branch in SquashTest this branch here: https://laymonagecustom-snippets-list-ss8iq.squash.io |
d549368
to
4d57e78
Compare
833f027
to
ee477dc
Compare
Hold on, I haven't added docs in the |
ee477dc
to
15f8948
Compare
Ok, docs added. |
15f8948
to
b01a7a5
Compare
b01a7a5
to
6e180a8
Compare
…terableSnippet with FullFeaturedSnippet
get_fields() only returns the model fields, but filters can also be model fields + lookups, e.g. `text__contains`
6e180a8
to
a5ca001
Compare
filterset_class
for snippets and generic IndexView
through list_filter
#
filterset_class
for snippets and generic IndexView
through list_filter
#filterset_class
for snippets and generic IndexView
through list_filter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All looks good to me!
@@ -0,0 +1,32 @@ | |||
# Generated by Django 4.2b1 on 2023-03-21 17:12 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this file needs renumbering - will do that while I merge.
Merged in a3498b2 |
As part of wagtail/rfcs#85.
This PR adds a
get_filterset_class
on the genericIndexView
that automatically generates aWagtailFilterSet
subclass with the fields defined inIndexView.list_filter
. The API is also surfaced in theSnippetViewSet
class to ease customisation for Snippets'IndexView
.For Snippets'
IndexView
, theget_filterset_class()
method works by callingSnippetViewSet.get_filterset_class()
first. If the result isNone
, it then falls back to the genericIndexView.get_filterset_class()
implementation where the class is dynamically generated if necessary.Please check the following:
make lint
from the Wagtail root.Please describe additional details for testing this change.
Continuing from the test example in #10241.
Footnotes
Development Testing ↩