Issue with POST Method Returning 405 on ModelViewSet · encode/django-rest-framework · Discussion #9627 · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
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 4 replies

Comment options

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

@browniebroke
Comment options

@NeyDiallo
Comment options

Answer selected by browniebroke
@hypsug0
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.