diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index 49eec82591..13e93ef9ff 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -209,7 +209,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.' @@ -712,7 +712,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'), (