Skip to content
Discussion options

You must be logged in to vote

I haven't tried django-filter yet, but I think it should work if you define an adapter for FilterSet and Filter, much like we do for Django forms. The documentation on how that works is here: https://django-bridge.org/docs/python2react/

Once adapters have been created, you should be able to pass the filter object into a Django Bridge Response and it'll be automatically converted to javascript and passed in to your React components props:

from django_bridge.response import Response


def product_list(request):
    f = ProductFilter(request.GET, queryset=Product.objects.all())
    return Response(request, 'my-react-component', {'filter': f})

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kaedroho
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants