I want the create (POST on / users /) method not to request any authentication.
Actually, this is not exactly what you want. You want POSTusers to not require any permissions, which can lead to the successful completion of authenticated or unauthorized requests.
, POST. .
- :
class IsAuthenticatedOrCreate(permissions.IsAuthenticated):
def has_permission(self, request, view):
if request.method == 'POST':
return True
return super(IsAuthenticatedOrCreate, self).has_permission(request, view)
, , - .