Skip to content

feat: Added the ability to filter with the contains and icontains operators for fields with a data type other than string.#2

Merged
SergeiVElfimov merged 2 commits into
mainfrom
operator_like_not_string_fields
Jun 10, 2025
Merged

feat: Added the ability to filter with the contains and icontains operators for fields with a data type other than string.#2
SergeiVElfimov merged 2 commits into
mainfrom
operator_like_not_string_fields

Conversation

@SergeiVElfimov
Copy link
Copy Markdown
Owner

Added the ability to filter with the contains and icontains operators for fields with a data type other than string.

Example

class UserFilter(Filter):
    name: str | None = None
    name__contains: str | None = None
    name__icontains: str | None = None
    name__neq: str | None = None
    address: AddressFilter | None = FilterDepends(with_prefix("address", AddressFilter))
    age__lt: int | None = None
    age__gt: int | None = None
    age__contains: str | None = None # New filter
    age__icontains: str | None = None # New filter

    order_by: list[str] = ["age"]
    search: str | None = None

    class Constants(Filter.Constants):
        model = User
        search_model_fields = ["name"]

@SergeiVElfimov SergeiVElfimov merged commit 51b108a into main Jun 10, 2025
8 checks passed
@SergeiVElfimov SergeiVElfimov deleted the operator_like_not_string_fields branch June 10, 2025 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant