I'm creating a rest api that's going to be consumed by desktop based clients.
I want my urls to be like this with a view class named ProjectView:
api.myapp.com/project/ -> uses ProjectView get
api.myapp.com/project/create/ -> uses ProjectView post
api.myapp.com/project/edit/ -> uses ProjectView put
I couldn't manage to bind a single view class to multiple urls without exposing all other actions(get, post, put) to that url. Instead I created ProjectView, ProjectViewCreate, ProjectViewEdit classes which seems pretty pointless.
Is there anyway I can accomplish the url configuration that I outlined with a single view class?
/createwill display a form,/shows a list, andedit/shows a form as well, so for aGET, it would result in three possible outcomes.request.build_absolute_uri('/').strip("/")or usingrequest.META['PATH_INFO']. But definitely have a look at this: django-rest-framework.org/api-guide/viewsets''function' object has no attribute 'get_extra_actions'errors, I decided this way of doing things is also pretty much pointless unless you are using URLs created by the router. Unfortunately I'm out of time so I won't be digging into that.