Warn that using an actual date or datetime value is probably wrong; it's only evaluated on server startup.
(self)
| 1485 | super().__init__(verbose_name, name, **kwargs) |
| 1486 | |
| 1487 | def _check_fix_default_value(self): |
| 1488 | """ |
| 1489 | Warn that using an actual date or datetime value is probably wrong; |
| 1490 | it's only evaluated on server startup. |
| 1491 | """ |
| 1492 | if not self.has_default(): |
| 1493 | return [] |
| 1494 | |
| 1495 | value = self.default |
| 1496 | if isinstance(value, datetime.datetime): |
| 1497 | value = _to_naive(value).date() |
| 1498 | elif isinstance(value, datetime.date): |
| 1499 | pass |
| 1500 | else: |
| 1501 | # No explicit date / datetime value -- no checks necessary |
| 1502 | return [] |
| 1503 | # At this point, value is a date object. |
| 1504 | return self._check_if_value_fixed(value) |
| 1505 | |
| 1506 | def deconstruct(self): |
| 1507 | name, path, args, kwargs = super().deconstruct() |
nothing calls this directly
no test coverage detected