1👍
✅
you can just crete an end point like
@api_view(['GET'])
def list_post_of_category(request,name=None):
category = Category.objects.get(name=name)
posts = category.posts.all().filter(is_active=True)
serializer = PostSerializer(posts,many=True)
return Response(serializer.data)
urlpatterns = [
path('post/category/<str:name>',list_post_of_category),
]
Source:stackexchange.com