Skip to content
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

Allow per-field overriding of default_operator #2

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

cript0nauta
Copy link

Hi! I'm thinking in using this library to refactor an existing RESTful API. I need to be able to override the default_operator attribute of some fields but not of all of them, but I noted that is not possible yet (the column_overrides doesn't use this). I wrote a simple fix for this issue.

With this change I could do something like this:

class AlbumFilterSet(FilterSet):
    class Meta:
        model = Album
        query = session.query(Album)
        operators = (Equal, Greater, Less)
        column_overrides = {
            'name': {'default_operator': Like}
        }

So I can do something like this:
```python
class AlbumFilterSet(FilterSet):
    class Meta:
        model = Album
        query = session.query(Album)
        operators = (Equal, Greater, Less)
        column_overrides = {
            'name': {'default_operator': Like}
        }
```
@llazzaro
Copy link

llazzaro commented Feb 5, 2018

@jmcarp Any news on this fix? I also hit the same bug.

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.

2 participants