Validate whether given value is valid :param value: Value to be validation :raises ValidationError: If validator check is not passed
(self, value: Any)
| 325 | return value |
| 326 | |
| 327 | def validate(self, value: Any) -> None: |
| 328 | """ |
| 329 | Validate whether given value is valid |
| 330 | |
| 331 | :param value: Value to be validation |
| 332 | :raises ValidationError: If validator check is not passed |
| 333 | """ |
| 334 | for v in self.validators: |
| 335 | if self.null and value is None: |
| 336 | continue |
| 337 | try: |
| 338 | if isinstance(value, Enum): |
| 339 | v(value.value) |
| 340 | else: |
| 341 | v(value) |
| 342 | except ValidationError as exc: |
| 343 | raise ValidationError(f"{self.model_field_name}: {exc}") |
| 344 | |
| 345 | def has_db_default(self) -> bool: |
| 346 | return not isinstance(self.db_default, _DB_DEFAULT_NOT_SET) |
no test coverage detected