-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Documented ObjectListView quick search feature for plugins #20500
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
base: main
Are you sure you want to change the base?
Conversation
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.
Thanks for the doc additions, @991jo . It's much appreciated!
I made some notes here and below:
- Let's clarify that the "Quick Search" field is the UI field, not the field in the filter or the method name.
- Your sentences appear to all be on a separate line, is there some reason to not have them on the same line and let MkDocs figure out the wrapping?
filterset_class = filtersets.MyModelFilterSet | ||
``` | ||
|
||
### Search function for use by the ObjectListView quick search |
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.
### Search function for use by the ObjectListView quick search | |
### Implementing Quick Search |
Q(description__icontains=value) | ||
) | ||
``` | ||
|
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.
Some things that I think are worth mentioning:
NetBoxModelFilterSet.search()
is already implemented and just returns the queryset unmodified, which is why it needs to be over-ridden here.- For context, the
search()
method is called as a result of theq
filter, which is already wire up inNetBoxModelFilterSet
and does not need to be over-ridden here unless different behavior is required.
### Search function for use by the ObjectListView quick search | ||
|
||
The `ObjectListView` has a field called Quick Search. | ||
For this field to work the corresponding FilterSet has to implement the `search` function. |
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.
For this field to work the corresponding FilterSet has to implement the `search` function. | |
For Quick Search to work the corresponding FilterSet has to implement the `search` method. |
Fixes: #20499