diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index 3896805177d..052a766cd8a 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -216,7 +216,7 @@ def save(self, **kwargs): return self.instance - def is_valid(self, raise_exception=False): + def is_valid(self, *, raise_exception=False): assert hasattr(self, 'initial_data'), ( 'Cannot call `.is_valid()` as no `data=` keyword argument was ' 'passed when instantiating the serializer instance.' @@ -735,7 +735,7 @@ def save(self, **kwargs): return self.instance - def is_valid(self, raise_exception=False): + def is_valid(self, *, raise_exception=False): # This implementation is the same as the default, # except that we use lists, rather than dicts, as the empty case. assert hasattr(self, 'initial_data'), (