1👍
✅
You don’t need to write urls, you just need to define two methods in your view:
# views.py
class FileView(...):
def get(self, request, *args, **kwargs):
# This method will catch the GET call
def delete(self, request, *args, **kwargs):
# This method will catch the DELETE call
With this, you will need only one url config:
url(r'^v1/files/(?P<pk>\d+)$', FileView.as_view(), name='api-file')
Source:stackexchange.com