Skip to content

RefForeignKey class

edgy.RefForeignKey

Bases: ForeignKeyFieldFactory, list

validate classmethod

validate(**kwargs)

Used to validate if all required parameters on a given field type are set. :param kwargs: all params passed during construction :type kwargs: Any

PARAMETER DESCRIPTION
**kwargs

TYPE: Any DEFAULT: {}

Source code in edgy/core/db/fields/ref_foreign_key.py
64
65
66
67
68
69
70
@classmethod
def validate(cls, **kwargs: Any) -> None:  # pragma no cover
    """
    Used to validate if all required parameters on a given field type are set.
    :param kwargs: all params passed during construction
    :type kwargs: Any
    """

get_column_type classmethod

get_column_type(**kwargs)

Returns the propery column type for the field

PARAMETER DESCRIPTION
**kwargs

TYPE: Any DEFAULT: {}

Source code in edgy/core/db/fields/ref_foreign_key.py
72
73
74
75
@classmethod
def get_column_type(cls, **kwargs: Any) -> Any:
    """Returns the propery column type for the field"""
    return None

get_constraints classmethod

get_constraints(**kwargs)
PARAMETER DESCRIPTION
**kwargs

TYPE: Any DEFAULT: {}

Source code in edgy/core/db/fields/ref_foreign_key.py
77
78
79
@classmethod
def get_constraints(cls, **kwargs: Any) -> Any:
    return []

is_class_and_subclass classmethod

is_class_and_subclass(value, _type)
PARAMETER DESCRIPTION
value

TYPE: Any

_type

TYPE: Any

Source code in edgy/core/db/fields/ref_foreign_key.py
 99
100
101
102
103
104
105
106
107
108
109
110
@classmethod
def is_class_and_subclass(cls, value: typing.Any, _type: typing.Any) -> bool:
    original = get_origin(value)
    if not original and not isclass(value):
        return False

    try:
        if original:
            return original and issubclass(original, _type)
        return issubclass(value, _type)
    except TypeError:
        return False