MCPcopy
hub / github.com/django/django / _check_fix_default_value

Method _check_fix_default_value

django/db/models/fields/__init__.py:1620–1632  ·  view source on GitHub ↗

Warn that using an actual date or datetime value is probably wrong; it's only evaluated on server startup.

(self)

Source from the content-addressed store, hash-verified

1618 # __init__ is inherited from DateField
1619
1620 def _check_fix_default_value(self):
1621 """
1622 Warn that using an actual date or datetime value is probably wrong;
1623 it's only evaluated on server startup.
1624 """
1625 if not self.has_default():
1626 return []
1627
1628 value = self.default
1629 if isinstance(value, (datetime.datetime, datetime.date)):
1630 return self._check_if_value_fixed(value)
1631 # No explicit date / datetime value -- no checks necessary.
1632 return []
1633
1634 def get_internal_type(self):
1635 return "DateTimeField"

Callers

nothing calls this directly

Calls 2

has_defaultMethod · 0.80
_check_if_value_fixedMethod · 0.80

Tested by

no test coverage detected