Return the default value to use when validating data if no input is provided for this field. If a default has not been set for this field then this will simply raise `SkipField`, indicating that no value should be set in the validated data for this field.
(self)
| 470 | raise type(exc)(msg) |
| 471 | |
| 472 | def get_default(self): |
| 473 | """ |
| 474 | Return the default value to use when validating data if no input |
| 475 | is provided for this field. |
| 476 | |
| 477 | If a default has not been set for this field then this will simply |
| 478 | raise `SkipField`, indicating that no value should be set in the |
| 479 | validated data for this field. |
| 480 | """ |
| 481 | if self.default is empty or getattr(self.root, 'partial', False): |
| 482 | # No default, or this is a partial update. |
| 483 | raise SkipField() |
| 484 | if callable(self.default): |
| 485 | if getattr(self.default, 'requires_context', False): |
| 486 | return self.default(self) |
| 487 | else: |
| 488 | return self.default() |
| 489 | |
| 490 | return self.default |
| 491 | |
| 492 | def validate_empty_values(self, data): |
| 493 | """ |
no test coverage detected