Skip to content

Issue with POST Method Returning 405 on ModelViewSet #9627

Discussion options

You must be logged in to vote

Thank you for your help!

I’ve identified the issue. In my DefaultRouter, I had registered a ViewSet with an empty prefix ('') before other more specific routes like 'lab/'.
I had something like that:

router.register('', PharmacyViewSet, basename='pharmacy')
router.register('lab', LaboratoryViewSet, basename='laboratory')

The problem was resolved by simply moving the registration of the ViewSet with the empty prefix ('') to the end of the router configuration.

Thanks again for pointing me in the right direction!

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@NeyDiallo
Comment options

@browniebroke
Comment options

@NeyDiallo
Comment options

Answer selected by browniebroke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants