Over here: http://www.django-rest-framework.org/api-guide/viewsets/#modelviewset it says "The actions provided by the ModelViewSet class are .list(), .retrieve(), .create(), .update(), .partial_update(), and .destroy()."
Over here: http://www.django-rest-framework.org/api-guide/serializers/#modelserializer it says "The ModelSerializer class is the same as a regular Serializer class, except that: It includes simple default implementations of .create() and .update()."
1) Assuming there is a Viewset UserViewSet
and router user
and serializer UserSerializer
. If I sent a POST
to /user/
does it call the UserViewSet
's create()
or the UserSerializer
's create()
?
2) Suppose UserViewSet
has this permission:
class NoCreate(permissions.BasePermission):
"""
No one can create this object.
"""
message = 'You do not have permission to complete the action you are trying to perform.'
def has_permission(self, request, view):
if view.action == "create":
return False
return True
Does the UserSerializer
's create()
still get called if I send a POST
to /user/
?