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

Problem with DRF pagination #949

Closed
csarcom opened this issue Jul 18, 2018 · 3 comments
Closed

Problem with DRF pagination #949

csarcom opened this issue Jul 18, 2018 · 3 comments

Comments

@csarcom
Copy link

csarcom commented Jul 18, 2018

If I use these settings with DRF pagination, I have some errors

REST_FRAMEWORK = {
    'DEFAULT_FILTER_BACKENDS': (
        'django_filters.rest_framework.DjangoFilterBackend'
    ),
    'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
    'PAGE_SIZE': 100   
}
rics.py", line 151, in filter_queryset
    for backend in list(self.filter_backends):
TypeError: 'RenameAttributes' object is not iterable

If I remove DEFAULT_FILTER_BACKENDS, it will work. Is that right?

@rpkilby
Copy link
Collaborator

rpkilby commented Jul 19, 2018

Hi @csarcom. The issue is that your DEFAULT_FILTER_BACKENDS is actually a string, not a tuple. You've wrapped the backend string in parentheses but left off the comma, so the parens evaluate the contents instead of creating a tuple. I typically recommend that users use lists instead of tuples for this reason.

@nawarazpokhrel
Copy link

Great Thank you

@Gorp
Copy link

Gorp commented May 10, 2021

Thanks

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

No branches or pull requests

5 participants