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

Can't get filter method to work #128

Open
perkalerk opened this issue Feb 7, 2022 · 0 comments
Open

Can't get filter method to work #128

perkalerk opened this issue Feb 7, 2022 · 0 comments
Labels
question Further information is requested

Comments

@perkalerk
Copy link

Hello,

I'm trying to filter a queryset using a method instead of field_name, but I can't get the method to be called.

Here is my code:

class CustomerMasterGlobalFilter(DatatablesFilterSet):

best_account_address = CharFilter(method='address_filter')

class Meta:
    model = CustomerMaster
    fields = ["best_account_address"]

def address_filter(self, queryset, name, value):
    print("filter called")

I realize I'm supposed to return a queryset with the method, but I can't even get the statement to print. It just doesn't do anything.

@matthewhegarty matthewhegarty added the question Further information is requested label Mar 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants