Django viewset has not attribute 'get_extra_actions'

You've called it a viewset, but that doesn't make it one; you inherit from APIView which is a standalone generic view, not a viewset.

A viewset needs to inherit from viewsets.ViewSet.


Before Django Rest Framework v3.8 you could register an APIView directly with a router. I did this extensively to gain a nice collated (and versioned) auto-documenting API for some very custom API endpoints. Given the choice again, I would probably write the whole thing a more standard way, but that isn't an option for everybody.

But after digging into the error, it turns out you can just patch over the problem by giving the router what it wants and adding a dummy get_extra_actions classmethod.

class MyAPIView(APIView):

    @classmethod
    def get_extra_actions(cls):
        return []

#...

I'm not saying this is good, but it works for now.
I've got my documentation back and I've managed to upgrade to DRFv3.8.