Docstring of Field.get_default is misleading (original) (raw)

Checklist

Issue

The docstring of Field.get_default says:

If a default has not been set for this field then this will simply
return empty, indicating that no value should be set in the
validated data for this field.

But if default has not been set the method raises SkipField instead.

if self.default is empty or getattr(self.root, 'partial', False): # No default, or this is a partial update. raise SkipField()

I suggest either to change the documentation to reflect the actual behaviour or change the code to reflect the doc.

https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/fields.py#L434