DjangoREST using DELETE and UPDATE with serializers
<p>So I followed the <a href="http://www.django-rest-framework.org/tutorial/quickstart/" rel="nofollow">Quickstart Guide</a> on the DjangoREST framewok site and ended up with the following code:</p>

<p><strong>serializers.py:</strong></p>

<pre><code>class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
    model = User
    fields = ('url', 'username', 'email', 'groups')


class GroupSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
    model = Group
    fields = ('url', 'name')
</code></pre>

<p><strong>views.py:</strong></p>

<pre><code>class UserViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows users to be viewed or edited.
"""
queryset = User.objects.all().order_by('-date_joined')
serializer_class = UserSerializer

class GroupViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows groups to be viewed or edited.
"""
queryset = Group.objects.all()
serializer_class = GroupSerializer
</code></pre>

<p><strong>urls.py:</strong></p>

<pre><code>router = routers.DefaultRouter()
router.register(r'users', views.UserViewSet)
router.register(r'groups', views.GroupViewSet)
router.register(r'rooms', views.RoomViewSet)
router.register(r'devices', views.DeviceViewSet)
router.register(r'deviceTypes', views.DeviceTypeViewSet)

# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^', include(router.urls)),
    url(r'^api-auth/', include('rest_framework.urls',  namespace='rest_framework'))
]
</code></pre>

<p>Now this all works fine, but I cant find out how to DELETE or UPDATE a user or a group, seems I can only add users and groups and view them.
So my question is:
How can I modify this code to make it possible to delete/update users and groups?</p>

<p>The code is fine, you just need to use <code>PUT</code> and <code>DELETE</code> data methods for update and delete respectively (instead of <code>GET/POST</code>)</p>

<p>You can see from the code example for a <code>ModelViewSet</code> in the <a href="http://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/#refactoring-to-use-viewsets" rel="nofollow">docs</a></p>

<pre><code>class SnippetViewSet(viewsets.ModelViewSet):
    """
    This viewset automatically provides `list`, `create`, `retrieve`,
    `update` and `destroy` actions.
</code></pre>

<p>and the docs for <a href="http://www.django-rest-framework.org/api-guide/viewsets/#modelviewset" rel="nofollow"><code>ModelViewSet</code></a></p>

<blockquote>
  <p>The actions provided by the ModelViewSet class are <code>.list()</code>, <code>.retrieve()</code>, <code>.create()</code>, <code>.update()</code>, <code>.partial_update()</code>, and <code>.destroy()</code>.</p>
</blockquote>

python django django-rest-framework