46👍
✅
You’re being redundant. The HTTP method is already DELETE
, so there’s no /events/delete
in the url. Try this:
curl -X DELETE "http://127.0.0.1:8000/events/1/"
By default, DRF’s router creates detailed urls at /event/<pk>
and you GET
, PUT
, POST
and DELETE
them to retrieve, update, create and delete respectively.
2👍
As mentioned by Kevin Stone, the pattern you’re using isn’t advisable, but if you want to use it, you’ll need to fix the typo in your urls for the events/delete/ mapping.
# delete event
url(r'^delete$/(?P<pk>\d+)',
views.EventDetail.as_view(), name='delete_event'),
should be:
# delete event
url(r'^delete/(?P<pk>\d+)',
views.EventDetail.as_view(), name='delete_event'),
- [Django]-Cannot resolve 'django.utils.log.NullHandler' in Django 1.9+
- [Django]-Change the width of form elements created with ModelForm in Django
- [Django]-Update django database to reflect changes in existing models
Source:stackexchange.com