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

CoreAPIURLFilterBackend causing recursion depth exceeded #94

Open
aslebloas opened this issue Feb 4, 2020 · 5 comments
Open

CoreAPIURLFilterBackend causing recursion depth exceeded #94

aslebloas opened this issue Feb 4, 2020 · 5 comments

Comments

@aslebloas
Copy link

Hello,

I tried to use CoreAPIURLFilterBackend to have the filters parameters showing up in our swagger documentation, but I have an errormaximum recursion depth exceeded when trying to access the documentation url.
It comes from:

/url_filter/integrations/drf_coreapi.py" in _all_filters
60.             for i in _all_filters(field, prefix=prefix + (name,)):

ModelViewSet is as such:

class ViewSet(ModelViewSet):
    filter_backends = [CoreAPIURLFilterBackend]
    filter_fields = ("id", "start_date", "status", "created_at", "updated_at")
    pagination_class = LargeResultSetPagination
    permission_classes = (permissions.IsAuthenticated)
    serializer_class = ViewSetSerializer

I tried this configuration but it would not fix it.

Django==2.2.9
django-url-filter==0.3.14

Would you have some ideas how to solve this issue?
Thank you very much.

@miki725
Copy link
Owner

miki725 commented Feb 7, 2020

dont think I have tested core api when viewset defines filterset. have you tried creating filterset explicitly?

@aslebloas
Copy link
Author

Yes, and I run into the same problem. Do you have any ideas?

@miki725
Copy link
Owner

miki725 commented Feb 15, 2020

hmm. usually worked for me. probably there is some edge case with some relations where it attempts to go in infinite loop.

@nmerty
Copy link

nmerty commented Jul 21, 2020

Goes into a infinite loop if a reference field is included in the FilterSet. @miki725 do you think it is simple to fix?

@simone6021
Copy link

simone6021 commented Nov 16, 2020

Run into the same issue, but did not had the time to look into thoroughly.
By the way i think that is because allow_related_reverse True by default: if a model has "circular" relations, this issue comes in.

Hope to have the time to look for a solution this weekend.

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

4 participants