Code
Hub
Workspaces
Connect
Indexed graphs
Engine
MCP
copy
hub
/
github.com/tortoise/tortoise-orm
/ has_db_default
Method
has_db_default
tortoise/fields/base.py:345–346 ·
view source on GitHub ↗
(self)
Source
from the content-addressed store, hash-verified
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)
347
348
@property
349
def
required(self) -> bool:
Callers
15
__init__
Method · 0.95
required
Method · 0.95
get_db_default_value
Method · 0.95
describe
Method · 0.95
deconstruct
Method · 0.95
_analyze_db_default_fields
Method · 0.80
finalise_fields
Method · 0.80
__init__
Method · 0.80
construct
Method · 0.80
_get_field_default
Method · 0.80
_alter_field
Method · 0.80
add_field
Method · 0.80
Calls
no outgoing calls
Tested by
14
test_db_default_not_set
Function · 0.64
test_db_default_set_int
Function · 0.64
test_db_default_set_str
Function · 0.64
test_db_default_set_bool
Function · 0.64
test_db_default_set_float
Function · 0.64
test_db_default_set_none
Function · 0.64
test_db_default_set_zero
Function · 0.64
test_db_default_set_empty_string
Function · 0.64
test_db_default_set_false
Function · 0.64
test_db_default_and_default_coexist
Function · 0.64
test_describe_with_db_default_none
Function · 0.64
test_copy_preserves_db_default
Function · 0.64