Generate URL Filter-squashed#2882
Open
samialfattani wants to merge 3 commits into
Open
Conversation
Closed
samuelhwilliams
requested changes
May 13, 2026
Contributor
samuelhwilliams
left a comment
There was a problem hiding this comment.
I think my main issue here is on the implementation being that the URL value is baked into the Filter definition. I'm not sure this feels like the right developer experience/API.
I think we should take this back to an issue and plan out the implementation up front rather than do it on a PR.
I think I'd be more interested in something like this:
filtered_url = view.url_for(
search="exam",
filters=[
(filters.FilterLike(Model1.test1, "Email"), "@example.com"),
(filters.BooleanEqualFilter(Model1.bool_field, "active"), False),
(filters.FloatGreaterFilter(Model1.test5, "Salary", 15.3),
],
)Ideally with full type support so that type checkers can statically verify that you've passed the correct argument type for the appropriate filter, ie boolean values for a Boolean filter and string values for a like filter.
Contributor
Author
|
now this style is adapted. you can check and review |
commit 3e99002e0e9dc46a0eac40961950490e7387bc42 Merge: e2e0092 c8ac222 Author: Sami Alfattani <Sami_alfattani@hotmail.com> Date: Sun May 24 10:12:20 2026 +0300 Merge branch 'master' into url-filter11 commit e2e0092 Author: Sami Alfattani <Sami_alfattani@hotmail.com> Date: Sat May 16 08:07:07 2026 +0300 refactor: remove url_value parameter from filter classes and update related code commit ab022e1 Author: Sami Alfattani <Sami_alfattani@hotmail.com> Date: Wed May 13 22:18:38 2026 +0300 fix typing commit a864bb7 Merge: 51c81b7 23be1ac Author: Sami Alfattani <Sami_alfattani@hotmail.com> Date: Wed May 13 21:35:37 2026 +0300 Merge branch 'master' into url-filter11 commit 51c81b7 Author: Sami Alfattani <Sami_alfattani@hotmail.com> Date: Wed May 13 21:11:11 2026 +0300 fix conflicts commit 8cdccec Author: Sami Alfattani <Sami_alfattani@hotmail.com> Date: Mon Apr 27 21:56:56 2026 +0300 Generate URL Filter This PR adds a function to generate a URL with filter arguements including all types of filters (Like, NotLike, Greater....etc) and including both indexed (`flt2_3=xx`) and named (`flt3_email_like=@example.com`) **Usage:** ``` filtered_url = view.url_for( search="exam", filters=[ filters.FilterLike(Model1.test1, "Email", url_value="@example.com"), filters.BooleanEqualFilter(Model1.bool_field, "active", url_value=False), filters.FloatGreaterFilter(Model1.test5, "Salary", url_value=15.3), ], ) ``` **Output:** `/admin/user/?search=exam&flt0_0=@example.com&flt1_21=0&flt2_16=15.3` **OR with named parameters:** `/admin/user/?search=exam&flt0_test1_contains=@example.com&flt1_bool_field_equals=0&flt4_test2_greater_than=15.3`
e2e0092 to
df827ea
Compare
ElLorans
reviewed
May 24, 2026
…dability in pytest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2703
This PR adds a function to generate a URL with filter arguements including all types of filters (Like, NotLike, Greater....etc) and including both indexed (
flt2_3=xx) and named (flt3_email_like=@example.com)Usage:
Output:
/admin/user/?search=exam&flt0_0=@example.com&flt1_21=0&flt2_16=15.3Output with named parameters:
/admin/user/?search=exam&flt0_test1_contains=@example.com&flt1_bool_field_equals=0&flt4_test2_greater_than=15.3