Menu
Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version
Publication date

Mar 9, 2022

Confidentiality
Public
Reactions
1
Share

NullableForeignKeyField

ForeignKeyField (null=True) whose instance value is typed Model | None.

The related model type is inferred from the constructor, no annotation needed:

owner = NullableForeignKeyField(User)   # -> User | None

For a self-reference, the model type cannot be inferred from the "self" string: specialize the generic explicitly (as a forward reference, since the class is not defined yet inside its own body):

parent = NullableForeignKeyField["MyModel"]("self")   # -> MyModel | None
Functions
__init__

Initialize self. See help(type(self)) for accurate signature.

model : Any
adapt
value : Any
alias
alias : Any
asc
collation : Any
nulls : Any
between
lo : Any
hi : Any
bin_and
rhs : Any
bin_or
rhs : Any
bind
model : Any
name : Any
set_attribute : bool - True
bind_to
dest : Any
cast
as_type : Any
clone
coerce
_coerce : bool - True
collate
collation : Any
concat
rhs : Any
contains
rhs : Any
converter
db_value
value : Any
ddl
ctx : Any
ddl_datatype
ctx : Any
desc
collation : Any
nulls : Any
distinct
endswith
rhs : Any
foreign_key_constraint
explicit_name : bool - False
get_constraint_name
get_modifiers
get_sort_key
ctx : Any
ilike
rhs : Any
in_
rhs : Any
iregexp
rhs : Any
is_alias
is_null
is_null : bool - True
like
rhs : Any
not_in
rhs : Any
python_value
value : Any
regexp
rhs : Any
startswith
rhs : Any
to_value
value : Any
unalias
unwrap
copy @staticmethod
method : Any
Shine Logo
Technical bricks to reuse or customize

Have you developed a brick?

Share it to accelerate projects for the entire community.