api - Restricting Django-Rest-Framework default CRUD operations to only GET and restricting POST, PUT and DELETE -
i using django-rest-framework. while following along tutorial able make crud apis defining modelresource. now, want limit access providing apis , not provide access post, put or delete. tried
allowed_methods = ('get')
but doesn't anything. also, tried override delete function of modelresource doesn't either , delete still works.
seems straight forward thing, havent been able figure out after spending couple of hours on it.
just saw this. have small error in code. instead of:
allowed_methods = ('get')
write
allowed_methods = ('get',)
note trailing comma, make python treat list 1 string instead of list 3 characters. due fact python treats string list of characters, first row evaluates list ('g','e','t')
, none of methods available on class.
Comments
Post a Comment