DjangoRestMultipleModels icon indicating copy to clipboard operation
DjangoRestMultipleModels copied to clipboard

Receiving attribute error viewset has no attribute 'get_extra_actions'

Open selvania opened this issue 2 years ago • 1 comments

When using the standardized format, I am getting the error that FileViewset has no attribute 'get_extra_actions'

I have tried routing the view using 'as_view' in the router.register function, but that only receives further issues. Viewset appears as:

`class FileViewset(ObjectMultipleModelAPIView): querylist = ( {'queryset': UploadedFile.objects.filter(id__in=list(EntryFile.objects.all().values_list('entry_id', flat=True))), 'serializer_class':FileSerializer}, {'queryset': FileLink.objects.all(), 'serializer_class':FileLinkSerializer} )

#for the router router.register(r'file', FileViewset, basename='files')

selvania avatar Nov 16 '22 19:11 selvania

It looks like you accidental imported the View from the library, rather than the Viewset. You instead want:

from drf_multiple_model.viewsets import ObjectMultipleModelAPIViewSet

MattBroach avatar Nov 16 '22 19:11 MattBroach